Issue |
147992
|
Summary |
Error: the type of variable template specialization declared with deduced type depends on itself
|
Labels |
new issue
|
Assignees |
|
Reporter |
Eczbek
|
https://godbolt.org/z/eWjrxjeds
GCC and MSVC accept this
```cpp
template<int>
struct A {
template<int x>
static constexpr auto foo = []<int y> {
return A<(x + y)>();
};
template<int x>
using bar = decltype(foo<0>.template operator()<x>());
template<int x>
using baz = decltype(foo<0>.template operator()<x>());
};
A<0> x;
int main() {}
```
```
<source>:9:29: error: member reference base type 'const auto' is not a structure or union
9 | using bar = decltype(foo<0>.template operator()<x>());
| ~~~~~~^ ~~~~~~~~
<source>:8:2: note: in instantiation of template type alias 'bar' requested here
8 | template<int x>
| ^
<source>:15:6: note: in instantiation of template class 'A<0>' requested here
15 | A<0> x;
| ^
<source>:12:23: error: the type of variable template specialization 'foo<0>' declared with deduced type 'const auto' depends on itself
12 | using baz = decltype(foo<0>.template operator()<x>());
| ^
<source>:11:2: note: in instantiation of template type alias 'baz' requested here
11 | template<int x>
| ^
<source>:15:6: note: in instantiation of template class 'A<0>' requested here
15 | A<0> x;
| ^
2 errors generated.
Compiler returned: 1
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs