possibly ambiguous wording in [namespace.udir]p6

Discussion in 'C++' started by Ivan Sorokin, Oct 18, 2012.

  1. Ivan Sorokin

    Ivan Sorokin Guest

    Is the following code a correct C++ program?

    namespace a
    {
    struct x
    {};
    }

    namespace b
    {
    namespace d = a;
    }

    namespace c
    {
    namespace d = a;
    }

    using namespace b;
    using namespace c;

    d::x x;

    Is "d" in "d::x" ambiguous or not? MSVC accepts this code, while
    clang, gcc and EDG reject it.

    [namespace.udir]p3: If name lookup finds a declaration for a name in
    two different namespaces, and the declarations do not declare the same
    entity and do not declare functions, the use of the name is ill-
    formed.

    Does namespace-alias declares new entity or refers to existing?

    According to [namespace.alias]p3 redefinition of namespace-alias in
    the same declarative region is ok as long as it refers to the same
    namespace, but [namespace.alias]p3 doesn't say anything about
    interaction with using-directives.
    Ivan Sorokin, Oct 18, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Frankie Montenegro
    Replies:
    3
    Views:
    508
    Frankie Montenegro
    Oct 14, 2005
  2. Paulo Jorge de O. C. de Matos

    Question on Wording

    Paulo Jorge de O. C. de Matos, Apr 26, 2008, in forum: C Programming
    Replies:
    8
    Views:
    323
    David Thompson
    May 5, 2008
  3. Jason R. Coombs
    Replies:
    0
    Views:
    216
    Jason R. Coombs
    Jun 13, 2008
  4. grocery_stocker
    Replies:
    4
    Views:
    244
    grocery_stocker
    May 2, 2009
  5. Ersek, Laszlo

    posting history -- wording of C1X sequencing

    Ersek, Laszlo, Sep 23, 2010, in forum: C Programming
    Replies:
    1
    Views:
    288
    Shao Miller
    Sep 24, 2010
Loading...

Share This Page