This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: namespace lookup bug


> I've been led to be believe that having two namespaces with the same
> name, nested at different points in namespace tree should work, but I
> can't seem to get it to compile.

It does work, apparently just not the way you have been led to
believe.

> class C::A::ClassB : public A::B::ClassA

With 'class C::A::ClassB', you re-open namespace ::C::A::. Here, the
name A::B::ClassA must be resolved. A resolves to ::C::A, and then you
get

> ClassB.cc:23: `B' is not a class or namespace

To fix this, write

  class C::A::ClassB : public ::A::B::ClassA

Hope this helps,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]