aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-08 19:14:19 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-11-08 19:14:19 +0000
commite6fe9a28bc5ceec284099c1e5bc90e2316ade3de (patch)
tree9375bac1756b69727bc04f6bb818b038fb7b0b21 /lib
parentda4ad9fa26b607adde033badcf67396ebc0cfe17 (diff)
When building a compound literal, check that the base element of the array is complete.
Fixes rdar://8620582 & http://llvm.org/PR7905 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118428 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaExpr.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 38e45c8a5f..0d0f48cd74 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3947,6 +3947,11 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo,
QualType literalType = TInfo->getType();
if (literalType->isArrayType()) {
+ if (RequireCompleteType(LParenLoc, Context.getBaseElementType(literalType),
+ PDiag(diag::err_illegal_decl_array_incomplete_type)
+ << SourceRange(LParenLoc,
+ literalExpr->getSourceRange().getEnd())))
+ return ExprError();
if (literalType->isVariableArrayType())
return ExprError(Diag(LParenLoc, diag::err_variable_object_no_init)
<< SourceRange(LParenLoc, literalExpr->getSourceRange().getEnd()));