]> granicus.if.org Git - clang/commitdiff
revert changes from r311851.
authorFaisal Vali <faisalv@yahoo.com>
Sun, 27 Aug 2017 19:00:08 +0000 (19:00 +0000)
committerFaisal Vali <faisalv@yahoo.com>
Sun, 27 Aug 2017 19:00:08 +0000 (19:00 +0000)
The right answers here (and how clang needs to be tweaked) require further analysis (ongoing cwg thread).

sorry.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311855 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExprMember.cpp
test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp

index 3d182f4c69ba97e70a3646fb809b00a9a0970252..47b18dc39ead2184e490b36eb8ff789b5bd18db8 100644 (file)
@@ -102,15 +102,15 @@ static IMAKind ClassifyImplicitMemberAccess(Sema &SemaRef,
   bool hasNonInstance = false;
   bool isField = false;
   BaseSet Classes;
-  for (const NamedDecl *const D : R) {   
+  for (NamedDecl *D : R) {
+    // Look through any using decls.
+    D = D->getUnderlyingDecl();
+
     if (D->isCXXInstanceMember()) {
-      // Look through any using decls.
-      const NamedDecl *const UnderlyingDecl = D->getUnderlyingDecl();
-      isField |= isa<FieldDecl>(UnderlyingDecl) ||
-                 isa<MSPropertyDecl>(UnderlyingDecl) ||
-                 isa<IndirectFieldDecl>(UnderlyingDecl);
+      isField |= isa<FieldDecl>(D) || isa<MSPropertyDecl>(D) ||
+                 isa<IndirectFieldDecl>(D);
 
-      const CXXRecordDecl *R = cast<CXXRecordDecl>(D->getDeclContext());
+      CXXRecordDecl *R = cast<CXXRecordDecl>(D->getDeclContext());
       Classes.insert(R->getCanonicalDecl());
     } else
       hasNonInstance = true;
index a6092f5b90dee6b1d3996ed84f4c116efd2d3146..9116e7146f812a339c597b4df2f0eff8f259d6ab 100644 (file)
@@ -64,26 +64,17 @@ namespace test2 {
 
   template <class T> struct A {
     void foo();
-    void foo2();
-    static void static_foo();
-    static void static_foo2();
-    
+
     void test0() {
       Unrelated::foo(); // expected-error {{call to non-static member function without an object argument}}
     }
 
     void test1() {
       B<T>::foo();
-      B<T>::foo2(); // expected-error {{call to non-static member function without an object argument}}
-      B<T>::static_foo();
-      B<T>::static_foo2();
     }
 
     static void test2() {
       B<T>::foo(); // expected-error {{call to non-static member function without an object argument}}
-      B<T>::foo2(); // expected-error {{call to non-static member function without an object argument}}
-      B<T>::static_foo();
-      B<T>::static_foo2();
     }
 
     void test3() {
@@ -92,17 +83,15 @@ namespace test2 {
   };
 
   template <class T> struct B : A<T> {
-    using A<T>::foo2;
-    using A<T>::static_foo2;
   };
-  
+
   template <class T> struct C {
   };
 
   int test() {
     A<int> a;
     a.test0(); // no instantiation note here, decl is ill-formed
-    a.test1(); // expected-note {{in instantiation}}
+    a.test1();
     a.test2(); // expected-note {{in instantiation}}
     a.test3(); // expected-note {{in instantiation}}
   }