https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66957
Casey Carter <Casey at Carter dot net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Casey at Carter dot net --- Comment #8 from Casey Carter <Casey at Carter dot net> --- The fix for this bug seems to have broken N4381-style customization points (http://wg21.link/n4381). To wit, this program used to compile: template <class T> T&& declval(); namespace X { namespace Y { int f(auto&&); struct fn { constexpr auto operator()(auto&& o) const { return f(o); } }; } namespace { constexpr auto f = Y::fn{}; } struct A {}; struct B { friend double f(B&); }; } static_assert(__is_same_as(int, decltype(X::f(declval<X::A&>())))); static_assert(__is_same_as(double, decltype(X::f(declval<X::B&>())))); but now results in the error "error: âfâ is not a member of âXâ" for both static_asserts. It's possible to workaround the error be declaring the anonymous namespace inline: inline namespace { constexpr auto f = Y::fn{}; } It appears that the non-visible friend function f declared in B is incorrectly blocking name lookup of X::f before the phase of lookup that considers namespaces nominated by using directives (such as unnamed namespaces).