https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85374
Bug ID: 85374 Summary: Confusing diagnostic for function with missing brace that looks like a function-try-block Product: gcc Version: 8.0 Status: UNCONFIRMED Keywords: diagnostic Severity: minor Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- I had a function that originally looked like: int func(int some, int params, int blah) { and I removed the parameters, unintentionally also removing the opening brace at the end of the line, to give: int func() // Oops, opening brace missing try { throw 1; } catch (...) { return 0; } return 1; } a.cc:9:5: error: expected unqualified-id before 'return' return 1; ^~~~~~ a.cc:10:1: error: expected declaration before '}' token } ^ Clang does a bit better by saying "extraneous closing brace": a.cc:9:5: error: expected unqualified-id return 1; ^ a.cc:10:1: error: extraneous closing brace ('}') } ^ 2 errors generated. I couldn't figure out what was wrong with the code from GCC's error, and only saw the problem after trying to compile it with Clang.