From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17681 invoked by alias); 31 May 2006 04:54:22 -0000 Received: (qmail 17663 invoked by uid 48); 31 May 2006 04:54:16 -0000 Date: Wed, 31 May 2006 04:54:00 -0000 Message-ID: <20060531045416.17662.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/26058] [4.0/4.1/4.2 Regression] C++ error recovery regression In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "mmitchel at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-05/txt/msg03181.txt.bz2 List-Id: ------- 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