Open
Description
With this code:
int main()
{
struct A
{
void foo(auto x) {} // auto not permitted
};
}
And clang-18,19,20 or trunk and -std=c++20
or -std=c++23
:
error: templates cannot be declared inside of a local class
No line number, no filename and refer to template
.
With -std=c++17
:
test.cpp:5:14: error: 'auto' not allowed in function prototype
5 | void foo(auto x) {}
| ^~~~
With gcc (same message for C++17 or C++20):
test.cpp: In function ‘int main()’:
test.cpp:5:14: error: ‘auto’ parameter not permitted in this context
5 | void foo(auto x) {}
| ^~~~