summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e5ac14e092c..e85ad03694a 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -738,7 +738,20 @@ ActOnCompoundLiteral(SourceLocation LParenLoc, TypeTy *Ty,
//assert((InitExpr != 0) && "ActOnCompoundLiteral(): missing expression");
Expr *literalExpr = static_cast<Expr*>(InitExpr);
- // FIXME: add more semantic analysis (C99 6.5.2.5).
+ if (literalType->isArrayType()) {
+ if (literalType->getAsVariableArrayType())
+ return Diag(LParenLoc,
+ diag::err_variable_object_no_init,
+ SourceRange(LParenLoc,
+ literalExpr->getSourceRange().getEnd()));
+ } else if (literalType->isIncompleteType()) {
+ return Diag(LParenLoc,
+ diag::err_typecheck_decl_incomplete_type,
+ literalType.getAsString(),
+ SourceRange(LParenLoc,
+ literalExpr->getSourceRange().getEnd()));
+ }
+
if (CheckInitializerTypes(literalExpr, literalType))
return true;
OpenPOWER on IntegriCloud