The following invalid code snippet triggers an ICE on mainline: ============================== template<int> void foo() { throw A(); struct A {} a; } template void foo<0>(); ============================== bug.cc: In function 'void foo()': bug.cc:3: error: there are no arguments to 'A' that depend on a template parameter, so a declaration of 'A' must be available bug.cc:3: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) bug.cc: In function 'void foo() [with int <anonymous> = 0]': bug.cc:7: instantiated from here bug.cc:3: error: 'A' was not declared in this scope bug.cc: At global scope: bug.cc: In instantiation of 'foo() [with int <anonymous> = 0]::A': bug.cc:4: instantiated from 'void foo() [with int <anonymous> = 0]' bug.cc:7: instantiated from here bug.cc:4: internal compiler error: Segmentation fault Please submit a full bug report, [etc.]
Confirmed.
typedecl = TYPE_MAIN_DECL (type); typedecl is NULL here. struct AD.1953 is the type.
Testing a patch.
Subject: Bug number PR c++/29363 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00914.html
Will not be fixed in 4.2.0; retargeting at 4.2.1.
Change target milestone to 4.2.3, as 4.2.2 has been released.
Lee, Patch was rejected: http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00976.html Was it your plan to give it another try from behind the drawing board? :-)
4.2.3 is being released now, changing milestones of open bugs to 4.2.4.
4.2.4 is being released, changing milestones to 4.2.5.
This bug should never have been in the waiting state, waiting state is for waiting on information from the reporter and not another developer.
Also this seems like this should be a P4 or lower as it is an error recovery issue.
Closing 4.2 branch.
GCC 4.3.4 is being released, adjusting target milestone.
Subject: Bug 29363 Author: jason Date: Fri Nov 13 18:46:39 2009 New Revision: 154163 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154163 Log: PR c++/29363 * decl.c (create_implicit_typedef): Set TYPE_STUB_DECL here. (cxx_init_decl_processing): Not here. * name-lookup.c (pushtag): Or here. * pt.c (lookup_template_class): Or here. Added: trunk/gcc/testsuite/g++.dg/template/error43.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/cp/name-lookup.c trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog
Fixed for 4.5.