using namespace
is weird. It doesn't bring the target namespace to the current scope, rather it brings it to the common enclosing namespace of the current and target namespace, which in practice means it gets less priority than normal declarations (except when it causes a conflict with a global-namespace name, which is an error). using second::x
behaves more like you'd expect (in your case it causes an error because it conflicts with int x;
).