Add an assertion so that we don't accidentally build constant arrays of
VLAs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72587 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 6608e12..fada7fe 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -909,7 +909,7 @@
if (!maxElementsKnown && elementIndex > maxElements)
maxElements = elementIndex;
}
- if (DeclType->isIncompleteArrayType()) {
+ if (!hadError && DeclType->isIncompleteArrayType()) {
// If this is an incomplete array type, the actual type needs to
// be calculated here.
llvm::APSInt Zero(maxElements.getBitWidth(), maxElements.isUnsigned());