Ambiguous name lookup with using-directive
问题 It's not allowed to put a namespace and a class with the same name into one declarative region, i.e. namespace A {} class A{}; is ill-formed (see §3.3.1/4). However, one can introduce the name of either one via a using-directive: namespace N { namespace A {int i;} } struct A {static int i;}; using namespace N; int i = A::i; // The global struct, or namespace N::A? Is this code ill-formed? VC++ thinks so, as well as Clang: main.cpp:7:9: error: reference to 'A' is ambiguous int i = A::i; ^ main