Two types exist with the same name, one ::Bar in the global namespace and one Stuff::Bar in a named namespace.
A new type ::Foo is derived from Stuff::Bar and given a member declared as "Bar b". The type of Foo::b ought to be ::Bar, since Foo is in the global namespace. However, Foo::b is incorrectly given the type Stuff::Bar. So an attempt to use Foo::b as if it had type ::Bar yields an error message. If Foo::b is explicitly typed ::Bar, there is no problem. Also if ::Bar is renamed to ::Baz so it doesn't clash with Stuff::Bar, there is no problem. Checked on gcc version 3.3 (Apple) and on 3.3.4 and on 3.3.5 (Debian). -- namespace Stuff { class Bar { public: int x; }; struct blat { int y; }; } class Bar { public: int y; }; class Foo: public Stuff::Bar { Bar b; /* ::Bar b; */ public: void doSomething (); }; void Foo::doSomething () { b. y = 4; /* "'class Stuff::Bar' has no member named 'y'" */ -- Summary: Incorrect resolution of unqualified global type name Product: gcc Version: 3.3.5 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ajmalton at uwaterloo dot ca CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22467