This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: namespace lookup


On 5/24/07, Ching, Jimen (US SSA) <jimen.ching@baesystems.com> wrote:
Hi,

I have the following code:

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 .

Thanks,
Andrew Pinski


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