Bug 28293 - ICE on invalid typedef
Summary: ICE on invalid typedef
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Paolo Carlini
URL:
Keywords: ice-on-invalid-code, monitored
Depends on:
Blocks:
 
Reported: 2006-07-06 21:05 UTC by Volker Reichelt
Modified: 2009-09-09 23:34 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-09-03 07:27:46


Attachments
Slightly tweaked (only the testcase) patch (702 bytes, patch)
2009-09-09 16:23 UTC, Paolo Carlini
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-07-06 21:05:29 UTC
The following invalid code snippet triggers an ICE since at least GCC 2.95.3:

======================
template<int> void foo();

struct A
{
  typedef void foo<0>();
};
======================

bug.cc:5: internal compiler error: tree check: expected identifier_node, have template_id_expr in grokfield, at cp/decl2.c:805
Please submit a full bug report, [etc.]
Comment 1 Andrew Pinski 2006-09-03 07:27:46 UTC
Confirmed.
Comment 2 Paolo Carlini 2007-09-21 19:12:59 UTC
On it.
Comment 3 Paolo Carlini 2008-09-03 10:01:57 UTC
Patch at:
  
  http://gcc.gnu.org/ml/gcc-patches/2008-08/msg01070.html
Comment 4 Paolo Carlini 2009-09-09 16:23:18 UTC
Created attachment 18555 [details]
Slightly tweaked (only the testcase) patch
Comment 5 Paolo Carlini 2009-09-09 16:25:44 UTC
Jason, any chance you can have a look to the old patch of mine for this PR? I have regtested again a slightly tweaked version of the original one. Note, the issue is rather annoying to the users, because currently we ice without any previous error message.
Comment 6 Jason Merrill 2009-09-09 21:52:43 UTC
Subject: Re:  ICE on invalid typedef

On 09/09/2009 12:25 PM, paolo dot carlini at oracle dot com wrote:
> Jason, any chance you can have a look to the old patch of mine for this PR?

The patch is OK.

Jason
Comment 7 paolo@gcc.gnu.org 2009-09-09 23:32:14 UTC
Subject: Bug 28293

Author: paolo
Date: Wed Sep  9 23:31:47 2009
New Revision: 151580

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151580
Log:
/cp
2009-09-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/28293
	* decl.c (grokfield): Check for explicit template argument lists.

/testsuite
2009-09-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/28293
	* g++.dg/template/crash91.C: New.


Added:
    trunk/gcc/testsuite/g++.dg/template/crash91.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/testsuite/ChangeLog

Comment 8 paolo@gcc.gnu.org 2009-09-09 23:34:07 UTC
Subject: Bug 28293

Author: paolo
Date: Wed Sep  9 23:33:38 2009
New Revision: 151581

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151581
Log:
/cp
2009-09-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/28293
	* decl2.c (grokfield): Check for explicit template argument lists.

/testsuite
2009-09-09  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/28293
	* g++.dg/template/crash91.C: New.


Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl2.c

Comment 9 Paolo Carlini 2009-09-09 23:34:38 UTC
Fixed in mainline.