Extracted from larger confusing boost example where g++ and clang++ disagree on syntactic validity. Filing a small one: $ cat bug.cpp void d(void) { typename foo; } $ g++-11.0.0 -c bug.cpp -Wall -Wextra bug.cpp: In function 'void d()': bug.cpp:1:25: warning: unused variable 'foo' [-Wunused-variable] 1 | void d(void) { typename foo; } | ^~~ <success> $ clang++ -c bug.cpp -Wall -Wextra bug.cpp:1:25: error: expected a qualified name after 'typename' void d(void) { typename foo; } ^ bug.cpp:1:25: error: C++ requires a type specifier for all declarations 2 errors generated. <failure> It looks like g++ interpreted 'typename foo;' as 'int foo'. Should the example compile?
Confirmed.