https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96082
Bug ID: 96082 Summary: GCC rejects the template disambiguator with "typename" Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: haoxintu at gmail dot com Target Milestone: --- Hi, all. This code, test.cc, GCC rejects it in versions from 9.1 to trunk, but accepts it from 8.3 to 4.8 versions. $cat test.cc template <class> class A {}; int main () { typename :: template A <int> a; } $g++ test.cc test.cc: In function ‘int main()’: test.cc:3:26: error: ‘template’ must follow a nested-name-specifier 3 | typename :: template A <int> a; | ^~~~~~~ test.cc:3:26: error: expected ‘(’ 3 | typename :: template A <int> a; | ^~~~~~~ | I also tested in clang, icc, and msvc, they all accept this code.