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;").
Confirmed.
This is fixed for 4.8.0. I'm adding the testcase and closing the PR.
Done.