Created attachment 43635 [details] example in a friend declaration of the form class B::Y { friend int A::X::f (type); } (A & B are namespaces or enclosing classes). what scopes are searched for type? [basic.lookup.unqual]p10, tells us we should search class A::X as for member lookup, then if not found perform an unqualified lookup in the current scope -- that is B::Y, B, :: We instead search A::X then B::Y then A then ::. Other compilers also get this wrong in different ways. The example fails to compile because we find non-types in scopes we should not have searched.
I forgot the link to DR1906, which is now determined to be NAD http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1906