class scope bug in g++ 2.95
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Tue Aug 31 22:45:00 GMT 1999
> Where the typedef for D::T is placed inside class D is irrelevant
> since all type and member names are in scope inside a class. The
> inheritance from B should also be irrelevant. Either moving the
> typedef before the declaration of N or not deriving from B makes the
> code compile, but neither should have to be done.
Thanks for your bug report. This is not a bug in g++, but a bug in
your code. According to ISO C++, a name used in as a parameter type
must be declared before its use (3.4.1/8). If reordering of class
members yields an alternative valid program, the program is
ill-formed, no diagnostic required (3.3.6/1,3). This is the case with
your code.
Regards,
Martin
More information about the Gcc-bugs
mailing list