From: Douglas Gregor Date: Wed, 14 Jul 2010 23:20:53 +0000 (+0000) Subject: When determining whether an overload set with explicit template X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=66a8c9a6b1f9bcd78779e5d414f3c9ae3cabdd93;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108376 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 975ad0bfd4..c4ab9061b4 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -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(*I); + FunctionTemplateDecl *FunctionTemplate + = cast((*I)->getUnderlyingDecl()); // C++ [over.over]p2: // If the name is a function template, template argument deduction is diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp index dc79300af3..5556f35dbf 100644 --- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp +++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3.cpp @@ -43,3 +43,23 @@ namespace PR5949 { return Foo(b, quuz); } } + +// PR7641 +namespace PR7641 { + namespace N2 + { + template + int f0(int); + } + namespace N + { + using N2::f0; + } + + template + int + f1(R(a)(B1)); + + void f2() + { f1(N::f0); } +}