Bug 31745 - [4.3 regression] ICE on invalid use of namespace
Summary: [4.3 regression] ICE on invalid use of namespace
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2007-04-29 11:36 UTC by Volker Reichelt
Modified: 2007-05-25 21:11 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2007-04-29 11:36:49 UTC
The following invalid code snippet triggers an ICE on mainline:

===================
void foo()
{
  namespace N {
===================

bug.cc: In function 'void foo()':
bug.cc:3: error: 'namespace' definition is not allowed here
bug.cc:3: internal compiler error: in cp_lexer_consume_token, at cp/parser.c:638
Please submit a full bug report, [etc.]
Comment 1 patchapp@dberlin.org 2007-05-17 00:05:20 UTC
Subject: Bug number PR c++/31745

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-05/msg01091.html
Comment 2 Simon Martin 2007-05-25 20:27:04 UTC
Subject: Bug 31745

Author: simartin
Date: Fri May 25 20:26:36 2007
New Revision: 125070

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125070
Log:
2007-05-25  Simon Martin  <simartin@users.sourceforge.net>
	    Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	PR c++/31745
	* parser.c (cp_parser_skip_to_closing_brace): Return true if the next
	token is a closing brace, false if there are no tokens left.
	(cp_parser_namespace_alias_definition): Only consume the next token if
	it is a closing brace.

	* parser.c (cp_parser_class_specifier): Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/parse/crash34.C
    trunk/gcc/testsuite/g++.dg/parse/crash35.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Simon Martin 2007-05-25 20:33:55 UTC
Fixed on the mainline.
Comment 4 Andrew Pinski 2007-05-25 21:11:36 UTC
Fixed.