https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111790
Bug ID: 111790 Summary: Unwarranted missing template keyword warning Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: t.bart...@tu-berlin.de Target Milestone: --- Consider the following code: template <typename T> //no warning if this is not a template struct X { T v; }; template <typename T> inline void f() { X<T> x; //no warning with e.g. X<int> if(x.v < 0 && 0 > -1) {} //No warning without the "-" } int main() { f<int>(); //Still get a warning without this instantiation. } GCC 12, 13, current trunk and seemingly everything after b8ffa71e427 give me a warning for this: warning: expected 'template' keyword before dependent template name [-Wmissing-template-keyword] But GCC compiles it, so it seems to interpret it correctly at some point after triggering the warning. I tried to look into it and thought that maybe cp_lexer_peek_token (parser->lexer)->type <= CPP_LAST_PUNCTUATOR in line 6447 of gcc/cp/parser.cc is too general but I do not have a proposed patch.