------- Comment #3 from mmitchel at gcc dot gnu dot org 2006-05-31 04:54 ------- There is no way to win here.
The EDG front end skips the entire rest of the file: == "pr26058.cpp", line 4: error: expected a ";" int t2() {} ^ At end of source: warning: parsing restarts here after previous syntax error At end of source: warning: missing return statement at end of non-void function "t1" At end of source: error: expected a "}" == That's quieter, but it also means that it issues no error message about the bogus use of "i" in: int t1() { { // unclosed brace } int t2() {} if (i) ; It's not a good idea to pop back to the top level because function declarations are perfectly legal in function scope; it's just not legal to have a definition. So, the realistic choices are the EDG approach of just skipping to the end of the current block (which may be the end of the file), or the current behavior. I think the current behavior is better. I've also marked this P5, so that if someone decides to reopen the bug it will at least be clear that this is not a release-critical problem. -- mmitchel at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Priority|P3 |P5 Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26058