The following testcases cause ICEs since GCC 3.4.2: ======================================================================= template<typename> struct A { template<typename T> friend void* A<T>::operator new(); };
A<int> a; ======================================================================= bug.cc:3: error: 'operator new' takes type 'size_t' ('long unsigned int') as first parameter bug.cc:3: error: invalid template declaration of 'static void* A<T>::operator new(long unsigned int)' bug.cc: In instantiation of 'A<int>': bug.cc:6: instantiated from here bug.cc:3: internal compiler error: in tsubst_decl, at cp/pt.c:6360 Please submit a full bug report, [etc.] ======================================================================= template<typename> struct A { template<typename> friend void* operator new(__SIZE_TYPE__); }; A<int> a; ======================================================================= bug.cc:3: error: invalid template declaration of 'void* operator new(long unsigned int)' bug.cc:3: internal compiler error: Segmentation fault Please submit a full bug report, [etc.] The ICEs were fixed on mainline by the patch for PR 27559. I'll test a backport for the 4.1 branch and the 4.0 branch. -- Summary: [4.0/4.1 regression] ICE on invalid operator new Product: gcc Version: 4.1.1 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=27713