https://bugs.llvm.org/show_bug.cgi?id=45382

            Bug ID: 45382
           Summary: cannot initialize a variable of type [...] with an
                    lvalue of type 'const auto'
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangb...@nondot.org
          Reporter: ignacy.gawed...@green-communications.fr
                CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
                    llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk

The following presumably valid C++14 code:

  template <typename T>
  struct Foo {
    template <typename>
    static constexpr auto v = 0;
    static constexpr int w = v<T>;
  };

  template struct Foo<void>;

produces the following error:

  error: cannot initialize a variable of type 'const int' with an lvalue of
type 'const auto'
    static constexpr int w = v<T>;
                         ^   ~~~~

Replacing 'auto' with 'decltype(0)' makes it compile.

Versions 8 and below work fine.  Versions 9 and 10 produce the error.  GCC
works fine too.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to