class foo { public: typedef int bar; }; class baz { public: foo::bar foo; };
With G++ 3.3.6, this errors out with this diagnostic: $ g++-3.3 -pedantic -Wall -Wcast-align -Wwrite-strings -Wswitch-default -Wcast-qual -Wunused-variable -Wredundant-decls -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wold-style-cast -Woverloaded-virtual -fstrict-aliasing -c foo.cc foo.cc:8: error: declaration of `int baz::foo' foo.cc:1: error: changes meaning of `foo' from `class foo' With G++ 3.4, 4.0, 4.1 and 4.2 (current CVS), no diagnostic is issued. A diagnostic is not strictly required by the standard (ยง3.3.6, basic.scope.class), but would be very useful. Regards, Roger -- Summary: QOI: Diagnostic missing since 3.3.x when naming rule is violated Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rleigh at debian dot org GCC build triplet: powerpc-linux-gnu GCC host triplet: powerpc-linux-gnu GCC target triplet: powerpc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28513