Class declaration in same scope as using declaration compiles in GCC but not MSVS
Is the following program well-formed according to the c++ standard? namespace X { class A; } namespace Y { using X::A; class A {}; } int main() {} I'm getting different results with different compilers: gcc compiles it without errors. visual c++ gives error C2888: 'X::A': symbol cannot be defined within namespace 'Y' I don't find any rule in the c++ standard that my program violates. If the program is well-formed, why does visual studio give an error? If the program is not well-formed, what rule in the c++ standard did it violate and why doesn't gcc give an error? I'm not trying to make my