summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateDeduction.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-19 21:32:49 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-19 21:32:49 +0000
commitb491ed36b4ef9943e21fb47405b5ed8bea412b99 (patch)
treede8868396de7c68d645551bf1e8c841e32642c0d /clang/lib/Sema/SemaTemplateDeduction.cpp
parent47ffd35beac5a3a999baaf72f373d5ce8cf6f66f (diff)
downloadbcm5719-llvm-b491ed36b4ef9943e21fb47405b5ed8bea412b99.tar.gz
bcm5719-llvm-b491ed36b4ef9943e21fb47405b5ed8bea412b99.zip
Handle the resolution of a reference to a function template (which
includes explicitly-specified template arguments) to a function template specialization in cases where no deduction is performed or deduction fails. Patch by Faisal Vali, fixes PR7505! llvm-svn: 126048
Diffstat (limited to 'clang/lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateDeduction.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 5a0359c5fdb..fceeaa7fdd4 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -3322,9 +3322,11 @@ Sema::getMostSpecialized(UnresolvedSetIterator SpecBegin,
SourceLocation Loc,
const PartialDiagnostic &NoneDiag,
const PartialDiagnostic &AmbigDiag,
- const PartialDiagnostic &CandidateDiag) {
+ const PartialDiagnostic &CandidateDiag,
+ bool Complain) {
if (SpecBegin == SpecEnd) {
- Diag(Loc, NoneDiag);
+ if (Complain)
+ Diag(Loc, NoneDiag);
return SpecEnd;
}
@@ -3370,13 +3372,15 @@ Sema::getMostSpecialized(UnresolvedSetIterator SpecBegin,
}
// Diagnose the ambiguity.
- Diag(Loc, AmbigDiag);
+ if (Complain)
+ Diag(Loc, AmbigDiag);
+ if (Complain)
// FIXME: Can we order the candidates in some sane way?
- for (UnresolvedSetIterator I = SpecBegin; I != SpecEnd; ++I)
- Diag((*I)->getLocation(), CandidateDiag)
- << getTemplateArgumentBindingsText(
- cast<FunctionDecl>(*I)->getPrimaryTemplate()->getTemplateParameters(),
+ for (UnresolvedSetIterator I = SpecBegin; I != SpecEnd; ++I)
+ Diag((*I)->getLocation(), CandidateDiag)
+ << getTemplateArgumentBindingsText(
+ cast<FunctionDecl>(*I)->getPrimaryTemplate()->getTemplateParameters(),
*cast<FunctionDecl>(*I)->getTemplateSpecializationArgs());
return SpecEnd;
OpenPOWER on IntegriCloud