Hi,
I was wondering why this prints "unqual" and not "qual" since I have "using namespace a" before calling fun. I though that would be equivalant to having a::fun() which should print "qual".
every name from namespace-name is visible as if it were declared in the nearest enclosing namespace which contains both the using-directive and namespace-name.
In your code the "nearest enclosing namespace" is namespace a. So a::fun() is still treated as being declared in namespace a and that is why a::b::fun() is still chosen on line 19.
Or perhaps the "nearest enclosing namespace" is really the global namespace, because namespace a doesn't contain itself, but that doesn't make any difference.