https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86998
Bug ID: 86998 Summary: Improve diagnostic for missing comma in template-parameter-list Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- template<typename T typename U> void f() { } GCC says: err.cc:1:19: error: expected nested-name-specifier before 'T' 1 | template<typename T typename U> void f() { } | ^ err.cc:1:21: error: expected '>' before 'typename' 1 | template<typename T typename U> void f() { } | ^~~~~~~~ The first error is not helpful. The second error is OK, although it would be more correct (and helpful) to say that a comma would also be accepted, as Clang does: err.cc:1:19: error: expected a qualified name after 'typename' template<typename T typename U> void f() { } ^ err.cc:1:21: error: expected ',' or '>' in template-parameter-list template<typename T typename U> void f() { } ^ 2 errors generated. I don't know why all of GCC, Clang and EDG say something about a nested-name-specifier or qualified name for the first template-parameter. I don't think the grammar allows a qualified-id there, only a plain identifier.