This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/22467] New: Incorrect resolution of unqualified global type name
- From: "ajmalton at uwaterloo dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Jul 2005 19:25:30 -0000
- Subject: [Bug c++/22467] New: Incorrect resolution of unqualified global type name
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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