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.]
Confirmed.
On it.
Patch at: http://gcc.gnu.org/ml/gcc-patches/2008-08/msg01070.html
Created attachment 18555 [details] Slightly tweaked (only the testcase) patch
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.
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
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
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
Fixed in mainline.