[cfe-commits] r102317 - in /cfe/trunk: lib/Sema/SemaExpr.cpp lib/Sema/SemaLookup.cpp test/SemaCXX/member-expr.cpp

Douglas Gregor dgregor at apple.com
Sun Apr 25 14:15:30 PDT 2010


Author: dgregor
Date: Sun Apr 25 16:15:30 2010
New Revision: 102317

URL: http://llvm.org/viewvc/llvm-project?rev=102317&view=rev
Log:
When name lookup finds a single declaration that was imported via a
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.

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaLookup.cpp
    cfe/trunk/test/SemaCXX/member-expr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=102317&r1=102316&r2=102317&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun Apr 25 16:15:30 2010
@@ -2834,6 +2834,7 @@
 
   Diag(MemberDecl->getLocation(), diag::note_member_declared_here)
     << MemberName;
+  R.suppressDiagnostics();
   return ExprError();
 }
 
@@ -3514,7 +3515,8 @@
       // 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,

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=102317&r1=102316&r2=102317&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Sun Apr 25 16:15:30 2010
@@ -299,9 +299,10 @@
   // 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;
   }

Modified: cfe/trunk/test/SemaCXX/member-expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/member-expr.cpp?rev=102317&r1=102316&r2=102317&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/member-expr.cpp (original)
+++ cfe/trunk/test/SemaCXX/member-expr.cpp Sun Apr 25 16:15:30 2010
@@ -56,3 +56,19 @@
     }
   };
 }
+
+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);
+  }
+}





More information about the cfe-commits mailing list