diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 00be9d913503..3cfe53c65a3c 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -2834,6 +2834,7 @@ Sema::BuildMemberReferenceExpr(ExprArg Base, QualType BaseExprType, Diag(MemberDecl->getLocation(), diag::note_member_declared_here) << MemberName; + R.suppressDiagnostics(); return ExprError(); } @@ -3514,7 +3515,8 @@ Sema::ActOnCallExpr(Scope *S, ExprArg fn, SourceLocation LParenLoc, // declarations (all methods or method templates) or a single // method template. assert((MemE->getNumDecls() > 1) || - isa(*MemE->decls_begin())); + isa( + (*MemE->decls_begin())->getUnderlyingDecl())); (void)MemE; return BuildCallToMemberFunction(S, Fn, LParenLoc, Args, NumArgs, diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 558bd4eb96b8..1b2401a80cb0 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -299,9 +299,10 @@ void LookupResult::resolveKind() { // If there's a single decl, we need to examine it to decide what // kind of lookup this is. if (N == 1) { - if (isa(*Decls.begin())) + NamedDecl *D = (*Decls.begin())->getUnderlyingDecl(); + if (isa(D)) ResultKind = FoundOverloaded; - else if (isa(*Decls.begin())) + else if (isa(D)) ResultKind = FoundUnresolvedValue; return; } diff --git a/clang/test/SemaCXX/member-expr.cpp b/clang/test/SemaCXX/member-expr.cpp index fb8133cab040..54a95936bed1 100644 --- a/clang/test/SemaCXX/member-expr.cpp +++ b/clang/test/SemaCXX/member-expr.cpp @@ -56,3 +56,19 @@ namespace test3 { } }; } + +namespace test4 { + class X { + protected: + template void f(T); + }; + + class Y : public X { + public: + using X::f; + }; + + void test_f(Y y) { + y.f(17); + } +}