The following invalid code snippet triggers an ICE since GCC 4.4.0:
==================================================
struct A
{
template<typename T> void foo(T) = delete;
};
template<typename T> void A::foo(T) {}
void bar()
{
A().foo(0);
}
==================================================
bug.cc:6:27: error: redefinition of 'void A::foo(T)'
bug.cc:3:29: error: 'void A::foo(T)' previously declared here
bug.cc: In function 'void bar()':
bug.cc:3:29: error: deleted function 'void A::foo(T) [with T = int]'
bug.cc:10:12: error: used here
bug.cc: In member function 'void A::foo(T) [with T = int]':
bug.cc:10:12: instantiated from here
bug.cc:6:38: internal compiler error: in finish_function, at cp/decl.c:12250
Please submit a full bug report, [etc.]
By modifying the definition of foo, I can provoke crashes in different parts
of the compiler:
template<typename T> void A::foo(T) { A(); }
yields
bug.cc:6:39: internal compiler error: in poplevel, at cp/decl.c:536
and
template<typename T> void A::foo(T) { return; }
yields
bug1C.cc:6:39: internal compiler error: Segmentation fault
This is a regression as the compiler crashes even without -std=gnu++0x.
--
Summary: [4.4/4.5 Regression] ICE with defaulted functions
Product: gcc
Version: 4.5.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=40381