point at the template and print out its template arguments, e.g.,
ambiguous-ovl-print.cpp:5:8: note: candidate function template specialization
[with T = int]
void f(T*, long);
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81907
91177308-0d34-0410-b5e6-
96231b3b80d8
def err_ovl_deleted_member_call : Error<
"call to %select{unavailable|deleted}0 member function %1">;
def err_ovl_candidate : Note<"candidate function">;
+def err_ovl_template_candidate : Note<
+ "candidate function template specialization %0">;
def err_ovl_candidate_deleted : Note<
"candidate function has been explicitly %select{made unavailable|deleted}0">;
def err_ovl_builtin_candidate : Note<"built-in candidate function %0">;
// Deleted or "unavailable" function.
Diag(Cand->Function->getLocation(), diag::err_ovl_candidate_deleted)
<< Cand->Function->isDeleted();
+ } else if (FunctionTemplateDecl *FunTmpl
+ = Cand->Function->getPrimaryTemplate()) {
+ // Function template specialization
+ // FIXME: Give a better reason!
+ Diag(Cand->Function->getLocation(), diag::err_ovl_template_candidate)
+ << getTemplateArgumentBindingsText(FunTmpl->getTemplateParameters(),
+ *Cand->Function->getTemplateSpecializationArgs());
} else {
// Normal function
// FIXME: Give a better reason!
--- /dev/null
+// RUN: clang-cc -fsyntax-only -verify %s
+
+void f(void*, int); // expected-note{{candidate function}}
+template<typename T>
+ void f(T*, long); // expected-note{{candidate function template}}
+
+void test_f(int *ip, int i) {
+ f(ip, i); // expected-error{{ambiguous}}
+}