-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issuelambdaC++11 lambda expressionsC++11 lambda expressionsregression:21Regression in 21 releaseRegression in 21 release
Description
https://godbolt.org/z/eWjrxjeds
GCC and MSVC accept this
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
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issuelambdaC++11 lambda expressionsC++11 lambda expressionsregression:21Regression in 21 releaseRegression in 21 release