The following invalid code snippet is accepted since at least GCC 2.95.3: ================================== template<int> void foo() { struct A; struct B : A {}; }
template void foo<0>(); ================================== As A is incomplete, the definition of the local class B should trigger an error. This could already be diagnosed during definition of the template function, but is not even diagnosed at instantiation time. It is only diagnosed (at instantiation time) when B is used inside the function (for example in a variable declaration "B b;"). -- Summary: Invalid local class definition not diagnosed Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: accepts-invalid, 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=26572