Bug 28261 - [4.0 regression] ICE with enum in constructor definition
Summary: [4.0 regression] ICE with enum in constructor definition
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P2 normal
Target Milestone: 4.1.2
Assignee: Mark Mitchell
URL:
Keywords: ice-on-invalid-code, monitored
Depends on:
Blocks: 29535
  Show dependency treegraph
 
Reported: 2006-07-05 00:20 UTC by Volker Reichelt
Modified: 2007-02-03 20:43 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-08-28 02:33:29


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-07-05 00:20:28 UTC
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.]
Comment 1 Manuel López-Ibáñez 2006-08-12 20:40:03 UTC
I can confirm this in trunk rev 115951 on i686-pc-gnu-linux.
Comment 2 Janis Johnson 2006-08-12 21:45:54 UTC
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)
Comment 3 Volker Reichelt 2006-08-14 19:00:39 UTC
Confirmed by Manuel and Janis.
Comment 4 Mark Mitchell 2006-10-17 22:43:47 UTC
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

Comment 5 Mark Mitchell 2006-10-17 22:51:33 UTC
Fixed in 4.2.0.
Comment 6 Jakub Jelinek 2007-01-03 08:14:04 UTC
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

Comment 7 Jakub Jelinek 2007-01-03 08:18:48 UTC
Backported to 4.1.
Comment 8 Gabriel Dos Reis 2007-02-03 17:53:38 UTC
Fixed in GCC-4.1.1.
Comment 9 Volker Reichelt 2007-02-03 20:43:16 UTC
Actually it's not fixed in GCC 4.1.1, but in GCC 4.1.2.