> > namespace X > > { > > namespace Y > > { > > namespace Z > > { > > struct A { typedef int int_t; }; > > struct Z { typedef int int_t; }; } } } > > > > using namespace X::Y::Z; > > > > int > > main() > > { > > Z::A::int_t i = 0; > > Z::Z::int_t j = 0; > > return i == j; > > } > > Why did g++ look for struct A in struct Z instead of namespace Z? > > It looked for struct Z in namespace Z. > > Actually it did not look for struct Z in namespace Z. It > found the constructor Z in struct Z. Note this is a bug that > it found the constructor as the type, see > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11764 .
Even if g++ found constructor Z, it shouldn't have found int_t in it. I didn't get an error about int_t not found for Z::Z. --jc