aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-05-11 05:16:41 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-05-11 05:16:41 +0000
commitf7b8056f1ff0c0409a9523a34f78b69ab8314bec (patch)
tree1fb0849590b2e2429b9a560b9df7cc19698282da /lib/Sema/SemaOverload.cpp
parent79993dc53d212c663415d3c48ed5ec41cee2bdf7 (diff)
PR11857: When the wrong number of arguments are provided for a function
which expects exactly one argument, include the name of the argument in the diagnostic text. Patch by Terry Long! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156607 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index b99a638bda..2068006c29 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -8149,9 +8149,14 @@ void DiagnoseArityMismatch(Sema &S, OverloadCandidate *Cand,
std::string Description;
OverloadCandidateKind FnKind = ClassifyOverloadCandidate(S, Fn, Description);
- S.Diag(Fn->getLocation(), diag::note_ovl_candidate_arity)
- << (unsigned) FnKind << (Fn->getDescribedFunctionTemplate() != 0) << mode
- << modeCount << NumFormalArgs;
+ if (modeCount == 1 && Fn->getParamDecl(0)->getDeclName())
+ S.Diag(Fn->getLocation(), diag::note_ovl_candidate_arity_one)
+ << (unsigned) FnKind << (Fn->getDescribedFunctionTemplate() != 0) << mode
+ << Fn->getParamDecl(0) << NumFormalArgs;
+ else
+ S.Diag(Fn->getLocation(), diag::note_ovl_candidate_arity)
+ << (unsigned) FnKind << (Fn->getDescribedFunctionTemplate() != 0) << mode
+ << modeCount << NumFormalArgs;
MaybeEmitInheritedConstructorNote(S, Fn);
}