From dd5ef8f2a0cf7b27c33854a3017a15ce05c6b19a Mon Sep 17 00:00:00 2001 From: Faisal Vali Date: Sun, 27 Aug 2017 19:00:08 +0000 Subject: [PATCH] revert changes from r311851. 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 | 14 +++++++------- .../class.mfct/class.mfct.non-static/p3.cpp | 17 +++-------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/lib/Sema/SemaExprMember.cpp b/lib/Sema/SemaExprMember.cpp index 3d182f4c69..47b18dc39e 100644 --- a/lib/Sema/SemaExprMember.cpp +++ b/lib/Sema/SemaExprMember.cpp @@ -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(UnderlyingDecl) || - isa(UnderlyingDecl) || - isa(UnderlyingDecl); + isField |= isa(D) || isa(D) || + isa(D); - const CXXRecordDecl *R = cast(D->getDeclContext()); + CXXRecordDecl *R = cast(D->getDeclContext()); Classes.insert(R->getCanonicalDecl()); } else hasNonInstance = true; diff --git a/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp b/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp index a6092f5b90..9116e7146f 100644 --- a/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp +++ b/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp @@ -64,26 +64,17 @@ namespace test2 { template 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::foo(); - B::foo2(); // expected-error {{call to non-static member function without an object argument}} - B::static_foo(); - B::static_foo2(); } static void test2() { B::foo(); // expected-error {{call to non-static member function without an object argument}} - B::foo2(); // expected-error {{call to non-static member function without an object argument}} - B::static_foo(); - B::static_foo2(); } void test3() { @@ -92,17 +83,15 @@ namespace test2 { }; template struct B : A { - using A::foo2; - using A::static_foo2; }; - + template struct C { }; int test() { A 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}} } -- 2.50.1