Bug 18731 - [3.3/3.4/4.0 regression] ICE on invalid template declaration
Summary: [3.3/3.4/4.0 regression] ICE on invalid template declaration
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 3.4.4
Assignee: Volker Reichelt
URL:
Keywords: ice-on-invalid-code, monitored, patch
Depends on:
Blocks:
 
Reported: 2004-11-30 00:33 UTC by Volker Reichelt
Modified: 2004-12-15 13:07 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-12-09 15:54:55


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2004-11-30 00:33:56 UTC
The following invalid code snippet causes an ICE since gcc 3.3
(it also crashes gcc 2.95.x, 3.0.x, but doesn't crash gcc 3.1.x, 3.2.x):

=======================================
template<typename T> struct T::A {};
=======================================

Mainline issues the following error message:

bug.cc:5: internal compiler error: in is_ancestor, at cp/name-lookup.c:2185
Please submit a full bug report, [etc.]
Comment 1 Andrew Pinski 2004-11-30 00:39:17 UTC
: Search converges between 2002-12-14-trunk (#159) and 2002-12-29-trunk (#160).

Confirmed.
Comment 2 Andrew Pinski 2004-12-10 13:50:02 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-12/msg00742.html>.
Comment 3 GCC Commits 2004-12-10 16:04:33 UTC
Subject: Bug 18731

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	reichelt@gcc.gnu.org	2004-12-10 16:04:22

Modified files:
	gcc/cp         : ChangeLog parser.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/parse: struct-1.C struct-2.C struct-3.C 

Log message:
	PR c++/18731
	* parser.c (cp_parser_class_head): Reject typedef-name in class head.
	
	* g++.dg/parser/struct-1.C: New test.
	* g++.dg/parser/struct-2.C: New test.
	* g++.dg/parser/struct-3.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4527&r2=1.4528
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.292&r2=1.293
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4734&r2=1.4735
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/struct-1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/struct-2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/struct-3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 5 Volker Reichelt 2004-12-10 16:15:31 UTC
Fixed on mainline and for 3.4.4
Comment 6 Volker Reichelt 2004-12-15 13:07:36 UTC
Won't fix on the 3.3 branch.