This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/26572] New: Invalid local class definition not diagnosed
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Mar 2006 03:09:29 -0000
- Subject: [Bug c++/26572] New: Invalid local class definition not diagnosed
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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