MSVC compiles this code:
template <class T>
void f(T t)
But this code is incorrect, because namespace ns is not associated namespace for class X.
According to C++ standard [basic.lookup.argdep]p2:
"If T is a class type (including unions), its associated classes are: the class itself; the class of which it is a member, if any; and its direct and indirect base classes. <b>Its associated namespaces are the namespaces of which its associated classes are members.</b>"