https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113839
Bug ID: 113839 Summary: misleading syntax error message Product: gcc Version: 13.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: f.heckenb...@fh-soft.de Target Milestone: --- % cat test.cpp void f () { static int { }; } % g++ test.cpp test.cpp: In function 'void f()': test.cpp:3:3: error: expected primary-expression before 'static' 3 | static int { }; | ^~~~~~ This message is clearly misleading. There is nothing missing before "static", but rather the variable name after "int" is missing. I seem to get a lot of such confusing messages, to the point I tend to ignore the wording of the messages and treat them as generic "syntax error" messages, which is sad. While I appreciate gcc trying to by helpful, it seems it goes wrong rather often. I'd prefer if gcc (by default, or at least optional) would limit itself to reporting actual errors if and when they occur. (In this case, the program is correct up to and including "static int", so there shouldn't be any error reported on that part.)