[cfe-commits] r108376 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp

Douglas Gregor dgregor at apple.com
Wed Jul 14 16:20:53 PDT 2010


Author: dgregor
Date: Wed Jul 14 18:20:53 2010
New Revision: 108376

URL: http://llvm.org/viewvc/llvm-project?rev=108376&view=rev
Log:
When determining whether an overload set with explicit template
arguments only resolves to a single specialization, make sure to look
through using declarations. Fixes PR7641.

Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=108376&r1=108375&r2=108376&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Jul 14 18:20:53 2010
@@ -6287,7 +6287,8 @@
     //   specified and it, along with any default template arguments, 
     //   identifies a single function template specialization, then the 
     //   template-id is an lvalue for the function template specialization.
-    FunctionTemplateDecl *FunctionTemplate = cast<FunctionTemplateDecl>(*I);
+    FunctionTemplateDecl *FunctionTemplate
+      = cast<FunctionTemplateDecl>((*I)->getUnderlyingDecl());
     
     // C++ [over.over]p2:
     //   If the name is a function template, template argument deduction is

Modified: cfe/trunk/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp?rev=108376&r1=108375&r2=108376&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp Wed Jul 14 18:20:53 2010
@@ -43,3 +43,23 @@
     return Foo<T>(b, quuz);
   }
 }
+
+// PR7641
+namespace PR7641 {
+  namespace N2
+  {
+    template<class>
+    int f0(int);
+  }
+  namespace N
+  {
+    using N2::f0;
+  }
+
+  template<class R,class B1>
+  int
+  f1(R(a)(B1));
+
+  void f2()
+  { f1(N::f0<int>); }
+}





More information about the cfe-commits mailing list