Diagnose implicit init list for empty aggregate, like struct {}.  Fixes 
PR2151 (by not creating the empty implicit init list).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51556 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 35dda28..6eb072e 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -57,6 +57,13 @@
   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;