Issue 125181
Summary [clang] Incorrect type error when using a variable member template of class template
Labels clang
Assignees
Reporter wreien
    Consider the following valid C++14 snippet (https://godbolt.org/z/jYGfzTf7P):
```cpp
template <typename>
struct S {
 template <typename> static const auto x = 1;
};

int r = S<int>::x<int>;
```
Clang trunk gives the following error:
```
<source>:6:5: error: cannot initialize a variable of type 'int' with an lvalue of type 'auto'
    6 | int r = S<int>::x<int>;
      |     ^ ~~~~~~~~~~~~~~
```
Removing either template resolves the error.  Marking `x` as `constexpr` also fixes in this particular case.

This error appears to have started with Clang 9.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to