summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorLarisse Voufo <lvoufo@google.com>2013-06-27 01:50:25 +0000
committerLarisse Voufo <lvoufo@google.com>2013-06-27 01:50:25 +0000
commit64cf3efd47bc79b661c93cea5a7a3fa60bba16d8 (patch)
tree120a9ca2c415aa7ceebf117d24a7789926f0bc28 /clang/lib/Sema/SemaInit.cpp
parentc76e60b012dde7b7e577ecd96f6de77b2313e639 (diff)
downloadbcm5719-llvm-64cf3efd47bc79b661c93cea5a7a3fa60bba16d8.tar.gz
bcm5719-llvm-64cf3efd47bc79b661c93cea5a7a3fa60bba16d8.zip
Fix a conversion to incomplete type bug -- The error message now specifically states that the type is incomplete and points to the forward declaration of the incomplete type.
llvm-svn: 185056
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 9d7fcda8fdd..cbca84da925 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -6251,9 +6251,15 @@ bool InitializationSequence::Diagnose(Sema &S,
break;
case OR_No_Viable_Function:
- S.Diag(Kind.getLocation(), diag::err_typecheck_nonviable_condition)
- << Args[0]->getType() << DestType.getNonReferenceType()
- << Args[0]->getSourceRange();
+ if (!DestType.getNonReferenceType()->isIncompleteType() ||
+ !S.RequireCompleteType(Kind.getLocation(),
+ DestType.getNonReferenceType(),
+ diag::err_typecheck_nonviable_condition_incomplete,
+ Args[0]->getType(), Args[0]->getSourceRange()))
+ S.Diag(Kind.getLocation(), diag::err_typecheck_nonviable_condition)
+ << Args[0]->getType() << Args[0]->getSourceRange()
+ << DestType.getNonReferenceType();
+
FailedCandidateSet.NoteCandidates(S, OCD_AllCandidates, Args);
break;
OpenPOWER on IntegriCloud