The following invalid testcase triggers an ICE since GCC 4.3.4: ======================================= template<typename> struct A { template<int> void foo();
template<> struct A<void> { template<int> void foo(); }; }; void bar() { A<void> a; a.foo<0>(); } ======================================= bug.cc:5:12: error: explicit specialization in non-namespace scope 'struct A< <template-parameter-1-1> >' bug.cc:5:21: error: template parameters not used in partial specialization: bug.cc:5:21: error: '<template-parameter-1-1>' bug.cc: In function 'void bar()': bug.cc:14:12: internal compiler error: in retrieve_specialization, at cp/pt.c:953 Please submit a full bug report, [etc.] A similar testcase is wrongly accepted since GCC 3.3 (before it it triggered an ICE): ======================================= template<typename> struct A { template<int> void foo(); template<typename T> struct A<T*> { template<int> void foo(); }; }; void bar() { A<void*> a; a.foo<0>(); } ======================================= -- Summary: [4.3/4.4/4.5 Regression] Trouble with invalid template specialization Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code, accepts-invalid, 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=42062