https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110562
Bug ID: 110562
Summary: GCC does not report the error about lambda contains
unexpanded parameter pack
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
GCC accepts the following invalid code, which is rejected by Clang and MSVC:
template<class... T>
void f() {
[]<T>(){ T x; };
};
int main() {
f<int, int, int>();
}
https://godbolt.org/z/nreTzPnsK
And if we call this lambda immediately like []<T>(){ T x; }(), gcc's error
message is quite confusing:
<source>:3:14: error: 'T x' has incomplete type
3 | []<T>(){ T x; }();
| ^
https://godbolt.org/z/vfrKGTsjq