The following invalid testcase triggers an ICE since at least GCC 2.95.3: ========================================= template<int> struct A { friend int foo(); };
void foo() { A<0> a; } ========================================= bug.cc: In instantiation of 'A<0>': bug.cc:6: instantiated from here bug.cc:3: error: new declaration 'int foo()' bug.cc:6: error: ambiguates old declaration 'void foo()' bug.cc: In function 'int foo()': bug.cc:6: internal compiler error: Segmentation fault Please submit a full bug report, [etc.] -- Summary: ICE with incompatible friend 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=28260