aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2019-02-01 22:06:02 +0000
committerEric Fiselier <eric@efcs.ca>2019-02-01 22:06:02 +0000
commit1147f71fed863639e3695a8be6979c39397d88b6 (patch)
treefa7d7f4ad57310891cadad2ea809660f0623975c /clang/lib/Sema/SemaInit.cpp
parent2e719bc428d27345da7cdcfa634c03ec69f31474 (diff)
downloadllvm-1147f71fed863639e3695a8be6979c39397d88b6.zip
llvm-1147f71fed863639e3695a8be6979c39397d88b6.tar.gz
llvm-1147f71fed863639e3695a8be6979c39397d88b6.tar.bz2
Improve diagnostic to tell you a type is incomplete.
I recently ran into this code: ``` \#include <iostream> void foo(const std::string &s, const std::string& = ""); \#include <string> void test() { foo(""); } ``` The diagnostic produced said it can't bind char[1] to std::string const&. It didn't mention std::string is incomplete. The user had to infer that. This patch causes the diagnostic to now say "incomplete type". llvm-svn: 352927
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index c1a7d479..6b9270a 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -8450,6 +8450,7 @@ bool InitializationSequence::Diagnose(Sema &S,
case FK_ReferenceInitFailed:
S.Diag(Kind.getLocation(), diag::err_reference_bind_failed)
<< DestType.getNonReferenceType()
+ << DestType.getNonReferenceType()->isIncompleteType()
<< OnlyArg->isLValue()
<< OnlyArg->getType()
<< Args[0]->getSourceRange();