]> granicus.if.org Git - clang/commitdiff
When determining whether an overload set with explicit template
authorDouglas Gregor <dgregor@apple.com>
Wed, 14 Jul 2010 23:20:53 +0000 (23:20 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 14 Jul 2010 23:20:53 +0000 (23:20 +0000)
arguments only resolves to a single specialization, make sure to look
through using declarations. Fixes PR7641.

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

lib/Sema/SemaOverload.cpp
test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp

index 975ad0bfd4b8d6d089e47240c829071e2541a4b9..c4ab9061b445c0eb8b3344ceb043251a1d0e21af 100644 (file)
@@ -6287,7 +6287,8 @@ FunctionDecl *Sema::ResolveSingleFunctionTemplateSpecialization(Expr *From) {
     //   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
index dc79300af33666949340af38b7bb667b581ae8e5..5556f35dbfd0065e983336c25ca16b6ca3d9a951 100644 (file)
@@ -43,3 +43,23 @@ namespace PR5949 {
     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>); }
+}