The following invalid testcase triggers an ICE since GCC 4.0.0: ========================================= struct A {}; A::A (enum { e }) {} ========================================= bug.cc:3: internal compiler error: in push_class_level_binding, at cp/name-lookup.c:2599 Please submit a full bug report, [etc.]
I can confirm this in trunk rev 115951 on i686-pc-gnu-linux.
A regression hunt on powerpc-linux identified the following patch: http://gcc.gnu.org/viewcvs?view=rev&rev=84689 r84689 | mmitchel | 2004-07-14 15:34:30 +0000 (Wed, 14 Jul 2004)
Confirmed by Manuel and Janis.
Subject: Bug 28261 Author: mmitchel Date: Tue Oct 17 22:43:37 2006 New Revision: 117835 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117835 Log: PR c++/28261 * parser.c (cp_lexer_next_token_is_decl_specifier_keyword): New function. (cp_parser_constructor_declarator_p): Use it. (cp_parser_check_type_definition): Return a value indicating whether or not the definition is valid. (cp_parser_enum_specifier): Skip invalid enum definitions. PR c++/28261 * g++.dg/parse/enum3.C: New test. Added: trunk/gcc/testsuite/g++.dg/parse/enum3.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
Fixed in 4.2.0.
Subject: Bug 28261 Author: jakub Date: Wed Jan 3 08:13:50 2007 New Revision: 120392 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120392 Log: PR c++/29535 Backported from mainline 2006-10-17 Mark Mitchell <mark@codesourcery.com> PR c++/28261 * parser.c (cp_lexer_next_token_is_decl_specifier_keyword): New function. (cp_parser_constructor_declarator_p): Use it. (cp_parser_check_type_definition): Return a value indicating whether or not the definition is valid. (cp_parser_enum_specifier): Skip invalid enum definitions. PR c++/28261 * g++.dg/parse/enum3.C: New test. PR c++/29535 * g++.dg/template/crash66.C: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/parse/enum3.C branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/crash66.C Modified: branches/gcc-4_1-branch/gcc/cp/ChangeLog branches/gcc-4_1-branch/gcc/cp/parser.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
Backported to 4.1.
Fixed in GCC-4.1.1.
Actually it's not fixed in GCC 4.1.1, but in GCC 4.1.2.