diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-09-24 17:48:32 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-09-24 17:48:32 +0000 |
commit | fd2a00a60837d19fcf27449d1c580bb1b24ba429 (patch) | |
tree | b95ab543654b477f2a22d2620e3b135baee59d2e /lib/Sema/SemaOverload.cpp | |
parent | 6df6548e44a61c444bd85dccd0398cba047c79b1 (diff) |
Add a special note for overload resolution when an initializer list argument
cannot be converted.
This is in preparation for overload resolution of initializer lists.
Currently, you will always get this message when you try to pass an init
list to an overloaded function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140461 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 513990e177..c2bf9d3848 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -6915,6 +6915,17 @@ void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand, unsigned I) { return; } + // Special diagnostic for failure to convert an initializer list, since + // telling the user that it has type void is not useful. + if (FromExpr && isa<InitListExpr>(FromExpr)) { + S.Diag(Fn->getLocation(), diag::note_ovl_candidate_bad_list_argument) + << (unsigned) FnKind << FnDesc + << (FromExpr ? FromExpr->getSourceRange() : SourceRange()) + << FromTy << ToTy << (unsigned) isObjectArgument << I+1; + MaybeEmitInheritedConstructorNote(S, Fn); + return; + } + // Diagnose references or pointers to incomplete types differently, // since it's far from impossible that the incompleteness triggered // the failure. |