The following testcase causes an ICE on the 4.1 branch and mainline:
====================================
struct A
{
template<int> void foo(X);
};
====================================
bug.cc:7: error: 'X' was not declared in this scope
bug.cc:7: error: variable or field 'foo' declared void
bug.cc:7: internal compiler error: tree check: expected var_decl, have
field_decl in cp_finish_decl, at cp/decl.c:4933
Please submit a full bug report, [etc.]
This is a very recent regression, since GCC 4.1.1 is not affected.
Mark, your patch for PR 27819 seems to have caused this:
http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00198.html
--
Summary: [4.1/4.2 regression] ICE on invalid template declaration
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code, error-recovery, monitored
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27961