Revert r325321 "[Sema] Take into account the current context when checking the"
authorHans Wennborg <hans@hanshq.net>
Fri, 16 Feb 2018 12:06:32 +0000 (12:06 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 16 Feb 2018 12:06:32 +0000 (12:06 +0000)
This broke the Chromium build, see https://crbug.com/813017

> accessibility of a class member.
>
> This fixes PR32898.
>
> rdar://problem/33737747
>
> Differential revision: https://reviews.llvm.org/D36918

llvm-svn: 325335

clang/lib/Sema/SemaAccess.cpp
clang/test/SemaCXX/access.cpp

index d2205dd..98a918b 100644 (file)
@@ -1793,11 +1793,6 @@ Sema::AccessResult Sema::CheckAddressOfMemberAccess(Expr *OvlExpr,
 
   AccessTarget Entity(Context, AccessTarget::Member, NamingClass, Found,
                       /*no instance context*/ QualType());
-
-  if (IsAccessible(*this, EffectiveContext(CurScope->getEntity()), Entity) ==
-      ::AR_accessible)
-    return AR_accessible;
-
   Entity.setDiag(diag::err_access)
     << Ovl->getSourceRange();
 
index 0707ec2..29a58a1 100644 (file)
@@ -169,38 +169,3 @@ namespace ThisLambdaIsNotMyFriend {
   }
   void bar() { foo<void>(); }
 }
-
-namespace OverloadedMemberFunctionPointer {
-  template<class T, void(T::*pMethod)()>
-  void func0() {}
-
-  template<class T, void(T::*pMethod)(int)>
-  void func1() {}
-
-  template<class T>
-  void func2(void(*fn)()) {} // expected-note 2 {{candidate function not viable: no overload of 'func}}
-
-  class C {
-  private:
-    friend void friendFunc();
-    void overloadedMethod();
-  protected:
-    void overloadedMethod(int);
-  public:
-    void overloadedMethod(int, int);
-    void method() {
-      func2<int>(&func0<C, &C::overloadedMethod>);
-      func2<int>(&func1<C, &C::overloadedMethod>);
-    }
-  };
-
-  void friendFunc() {
-    func2<int>(&func0<C, &C::overloadedMethod>);
-    func2<int>(&func1<C, &C::overloadedMethod>);
-  }
-
-  void nonFriendFunc() {
-    func2<int>(&func0<C, &C::overloadedMethod>); // expected-error {{no matching function for call to 'func2'}}
-    func2<int>(&func1<C, &C::overloadedMethod>); // expected-error {{no matching function for call to 'func2'}}
-  }
-}