Bug 18123 - [3.4/4.0 regression] ICE on templated enum
Summary: [3.4/4.0 regression] ICE on templated enum
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 minor
Target Milestone: 3.4.4
Assignee: Kriang Lerdsuwanakij
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored, patch
Depends on:
Blocks:
 
Reported: 2004-10-23 22:52 UTC by Volker Reichelt
Modified: 2004-12-02 11:52 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-10-23 23:07:28


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2004-10-23 22:52:39 UTC
Compiling the following invalid ocde snippet I get an ICE:

==============================
template<int> enum E { e };
==============================

bug.cc:1: error: template declaration of 'enum E'
bug.cc:1: internal compiler error: tree check: expected class 'declaration',
have 'exceptional' (error_mark) in pushdecl, at cp/name-lookup.c:641
Please submit a full bug report, [etc.]

The regression appeared with Kriang's patch
http://gcc.gnu.org/ml/gcc-cvs/2003-10/msg00781.html

Looks like some function cannot deal with the returned error_mark_node
in push_template_decl_real.
Comment 1 Andrew Pinski 2004-10-23 23:07:28 UTC
Confirmed.
Comment 2 Andrew Pinski 2004-10-23 23:08:42 UTC
: Search converges between 2003-10-20-trunk (#382) and 2003-10-23-trunk (#383).
Comment 3 Kriang Lerdsuwanakij 2004-10-24 08:44:05 UTC
Will look at it.
Comment 4 Mark Mitchell 2004-11-01 00:46:25 UTC
Postponed until GCC 3.4.4.
Comment 5 Kriang Lerdsuwanakij 2004-11-03 12:22:29 UTC
Patch submitted:
  http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00194.html
Comment 6 Kriang Lerdsuwanakij 2004-11-09 16:18:09 UTC
Old patch retracted, new patch in progress.
Comment 7 Kriang Lerdsuwanakij 2004-11-11 14:17:37 UTC
Revised patch posted:
  http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00890.html
Comment 8 GCC Commits 2004-12-02 11:35:07 UTC
Subject: Bug 18123

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	lerdsuwa@gcc.gnu.org	2004-12-02 11:34:57

Modified files:
	gcc/cp         : ChangeLog parser.c 
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.old-deja/g++.pt: enum5.C 
Added files:
	gcc/testsuite/g++.dg/parse: enum2.C 

Log message:
	PR c++/18123
	* parser.c (cp_parser_type_specifier): Catch template declaration
	of enum.
	
	* g++.dg/parse/enum2.C: New test.
	* g++.old-deja/g++.pt/enum5.C: Adjust error location.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4509&r2=1.4510
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.286&r2=1.287
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4705&r2=1.4706
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/enum2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.pt/enum5.C.diff?cvsroot=gcc&r1=1.5&r2=1.6

Comment 9 GCC Commits 2004-12-02 11:51:43 UTC
Subject: Bug 18123

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	lerdsuwa@gcc.gnu.org	2004-12-02 11:51:33

Modified files:
	gcc/cp         : ChangeLog parser.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/parse: enum2.C 

Log message:
	PR c++/18123
	* parser.c (cp_parser_type_specifier): Don't create new enum
	type if it is not in the form 'enum [identifier] { [...] };'.
	Catch template declaration of enum.
	
	* g++.dg/parse/enum2.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.180&r2=1.3892.2.181
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.157.2.45&r2=1.157.2.46
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.316&r2=1.3389.2.317
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/enum2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1

Comment 10 Kriang Lerdsuwanakij 2004-12-02 11:52:15 UTC
Fixed in 3.4 branch and mainline.