aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaInit.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 35dda28d4a..6eb072eeba 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -57,6 +57,13 @@ void InitListChecker::CheckImplicitInitList(InitListExpr *ParentIList,
else
assert(0 && "CheckImplicitInitList(): Illegal type");
+ if (maxElements == 0) {
+ SemaRef->Diag(ParentIList->getInit(Index)->getLocStart(),
+ diag::err_implicit_empty_initializer);
+ hadError = true;
+ return;
+ }
+
// Check the element types *before* we create the implicit init list;
// otherwise, we might end up taking the wrong number of elements
unsigned NewIndex = Index;