The following invalid testcase causes an ICE since GCC 4.0.0: =========================================== template<int> void foo(struct {}*); void bar() { foo<0>(0); } =========================================== bug.cc:1: error: template class without a name bug.cc:1: error: types may not be defined in parameter types bug.cc:5: error: conflicting declaration 'struct<anonymous>' bug.cc:5: error: 'struct<anonymous>' has a previous declaration as 'struct<anonymous>' bug.cc: In function 'void bar()': bug.cc:5: internal compiler error: tree check: expected tree that contains 'decl minimal' structure, have 'error_mark' in pushtag, at cp/name-lookup.c:4865 Please submit a full bug report, [etc.] Moreover only the second line of the error message makes sense. The "conflicting declaration" message is completely bogus, and the first line looks bogus to me, too.
Proposed patch at http://gcc.gnu.org/ml/gcc-patches/2006-06/msg01234.html
Subject: Bug 28114 Author: sje Date: Fri Jun 23 21:58:25 2006 New Revision: 114953 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114953 Log: PR c++/28114 * name-lookup.c (pushtag): Return if we have error_mark_node. Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/name-lookup.c
Confirmed, fixed at least on the mainline.
Subject: Bug 28114 Author: sje Date: Mon Jun 26 21:25:23 2006 New Revision: 115025 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115025 Log: PR c++/28114 * g++.dg/other/pr28114.C: New. Added: trunk/gcc/testsuite/g++.dg/other/pr28114.C Modified: trunk/gcc/testsuite/ChangeLog
Subject: Bug 28114 Author: sje Date: Mon Jul 10 20:42:14 2006 New Revision: 115314 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115314 Log: PR c++/28114 * name-lookup.c (pushtag): Return if we have error_mark_node. Modified: branches/gcc-4_1-branch/gcc/cp/ChangeLog branches/gcc-4_1-branch/gcc/cp/name-lookup.c
Subject: Bug 28114 Author: sje Date: Mon Jul 10 20:43:34 2006 New Revision: 115315 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115315 Log: PR c++/28114 * g++.dg/other/pr28114.C: New. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/other/pr28114.C Modified: branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
I have checked in a patch for ToT and on the 4.1 branch. My inclination is to not fix this on the 4.0 branch because the patch doesn't apply automatically. The same change is probably needed somewhere else for 4.0, but I don't think it is worth the trouble to find out where. Should I close this out as fixed in 4.1.2?
Subject: Re: [4.0/4.1 regression] ICE with struct definition in argument of template function On 10 Jul, sje at cup dot hp dot com wrote: > > > ------- Comment #7 from sje at cup dot hp dot com 2006-07-10 20:46 ------- > I have checked in a patch for ToT and on the 4.1 branch. My inclination is to > not fix this on the 4.0 branch because the patch doesn't apply automatically. > The same change is probably needed somewhere else for 4.0, but I don't think it > is worth the trouble to find out where. Well, with some trivial changes (whitespace, different number of parameters for pushdecl_with_scope) the patch applies to the 4.0 branch: =================================================================== --- gcc/gcc/cp/name-lookup.c (revision 115324) +++ gcc/gcc/cp/name-lookup.c (working copy) @@ -4666,7 +4666,11 @@ pushtag (tree name, tree type, tag_scope pushdecl_class_level (decl); } else if (b->kind != sk_template_parms) - decl = pushdecl_with_scope (decl, b); + { + decl = pushdecl_with_scope (decl, b); + if (decl == error_mark_node) + POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl); + } /* FIXME what if it gets a name from typedef? */ if (ANON_AGGRNAME_P (name)) =================================================================== Would you mind testing this on the 4.0 branch? Or should I do that? > Should I close this out as fixed in 4.1.2?
I am testing on the 4.0 branch now.
Subject: Bug 28114 Author: sje Date: Wed Jul 12 21:46:43 2006 New Revision: 115397 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115397 Log: PR c++/28114 * name-lookup.c (pushtag): Return if we have error_mark_node. Modified: branches/gcc-4_0-branch/gcc/cp/ChangeLog branches/gcc-4_0-branch/gcc/cp/name-lookup.c
Subject: Bug 28114 Author: sje Date: Wed Jul 12 21:47:58 2006 New Revision: 115398 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115398 Log: PR c++/28114 * g++.dg/other/pr28114.C: New. Added: branches/gcc-4_0-branch/gcc/testsuite/g++.dg/other/pr28114.C Modified: branches/gcc-4_0-branch/gcc/testsuite/ChangeLog
Fixed on mainline, 4.1 branch, and 4.0 branch.