[llvm-bugs] [Bug 45382] New: cannot initialize a variable of type [...] with an lvalue of type 'const auto'

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 1 01:23:28 PDT 2020


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: unassignedclangbugs at nondot.org
          Reporter: ignacy.gawedzki at green-communications.fr
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200401/5d08875e/attachment-0001.html>


More information about the llvm-bugs mailing list