]> granicus.if.org Git - clang/commitdiff
When name lookup finds a single declaration that was imported via a
authorDouglas Gregor <dgregor@apple.com>
Sun, 25 Apr 2010 21:15:30 +0000 (21:15 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sun, 25 Apr 2010 21:15:30 +0000 (21:15 +0000)
using declaration, look at its underlying declaration to determine the
lookup result kind (e.g., overloaded, unresolved). Fixes at least one
issue in Boost.Bimap.

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

lib/Sema/SemaExpr.cpp
lib/Sema/SemaLookup.cpp
test/SemaCXX/member-expr.cpp

index 00be9d913503dfdc2eb860a1806f9cc88d142b7e..3cfe53c65a3c2cb2092797e386c73f52d9c7f96f 100644 (file)
@@ -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<FunctionTemplateDecl>(*MemE->decls_begin()));
+             isa<FunctionTemplateDecl>(
+                                 (*MemE->decls_begin())->getUnderlyingDecl()));
       (void)MemE;
 
       return BuildCallToMemberFunction(S, Fn, LParenLoc, Args, NumArgs,
index 558bd4eb96b830b0e7c2b954534d923e9985284f..1b2401a80cb083e274614cd1e9775b7ec572c12e 100644 (file)
@@ -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<FunctionTemplateDecl>(*Decls.begin()))
+    NamedDecl *D = (*Decls.begin())->getUnderlyingDecl();
+    if (isa<FunctionTemplateDecl>(D))
       ResultKind = FoundOverloaded;
-    else if (isa<UnresolvedUsingValueDecl>(*Decls.begin()))
+    else if (isa<UnresolvedUsingValueDecl>(D))
       ResultKind = FoundUnresolvedValue;
     return;
   }
index fb8133cab04091c28246610859d68bd8f20b9d13..54a95936bed16524678a02e8a4362f08a1d4cfd1 100644 (file)
@@ -56,3 +56,19 @@ namespace test3 {
     }
   };
 }
+
+namespace test4 {
+  class X {
+  protected:
+    template<typename T> void f(T);
+  };
+
+  class Y : public X {
+  public:
+    using X::f;
+  };
+
+  void test_f(Y y) {
+    y.f(17);
+  }
+}