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]

non-ambiguous typedefs


Hi All,

I'm wondering if the following behavior is:

1.  An already reported bug.
2.  Not reported, I need to file a bugzilla.
3.  Disputed.

Here's the test case:

typedef unsigned short ushort;

namespace X
{
    typedef unsigned short ushort;
}

using namespace X;

int main()
{
    ushort us = 0;
}

We currently get:

error: 'ushort' was not declared in this scope

The deal is that the typedef ushort is defined in two different places, to the same type, and then brought "in conflict" via a using declaration. But since the two typedefs refer to the same type, I expect that the compiler will see that there is no conflict, and proceed without error or warning (reference C++03 7.1.3p2).

Had the two typedefs referred to different types, I expect the compiler to complain about an ambiguity, for example:

typedef unsigned short ushort;

namespace X
{
    typedef short ushort;
}

using namespace X;

int main()
{
    ushort us = 0;
}

error: ambiguous access to name found 'ushort' and 'X::ushort'

-Howard


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