Index: lib/Sema/SemaAccess.cpp =================================================================== --- lib/Sema/SemaAccess.cpp +++ lib/Sema/SemaAccess.cpp @@ -1793,6 +1793,11 @@ AccessTarget Entity(Context, AccessTarget::Member, NamingClass, Found, /*no instance context*/ QualType()); + + EffectiveContext EC(CurScope->getEntity()); + if (IsAccessible(*this, EC, Entity) == ::AR_accessible) + return AR_accessible; + Entity.setDiag(diag::err_access) << Ovl->getSourceRange(); Index: test/SemaCXX/access.cpp =================================================================== --- test/SemaCXX/access.cpp +++ test/SemaCXX/access.cpp @@ -169,3 +169,29 @@ } void bar() { foo(); } } + +namespace OverloadedMemberFunctionPointer { + template + void func0() {} + + template + void func1(void(*fn)()) {} // expected-note {{candidate function not viable: no overload of 'func0' matching 'void (*)()' for 1st argument}} + + class C { + friend void friendFunc(); + void overloadedMethod(); + public: + void overloadedMethod(int); + void method() { + func1(&func0); + } + }; + + void friendFunc() { + func1(&func0); + } + + void nonFriendFunc() { + func1(&func0); // expected-error {{no matching function for call to 'func1'}} + } +}