I
Ivan Sorokin
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.
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.