diff options
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r-- | lib/Sema/SemaInit.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 7c48a110b2..12ca3820dd 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -257,19 +257,18 @@ void InitListChecker::CheckArrayType(InitListExpr *IList, QualType &DeclType, } if (DeclType->isIncompleteArrayType()) { // If this is an incomplete array type, the actual type needs to - // be calculated here + // be calculated here. if (numElements == 0) { - // Sizing an array implicitly to zero is not allowed - // (It could in theory be allowed, but it doesn't really matter.) + // Sizing an array implicitly to zero is not allowed by ISO C, + // but is supported by GNU. SemaRef->Diag(IList->getLocStart(), - diag::err_at_least_one_initializer_needed_to_size_array); - hadError = true; - } else { - llvm::APSInt ConstVal(32); - ConstVal = numElements; - DeclType = SemaRef->Context.getConstantArrayType(elementType, ConstVal, - ArrayType::Normal, 0); + diag::ext_typecheck_zero_array_size); } + + llvm::APSInt ConstVal(32); + ConstVal = numElements; + DeclType = SemaRef->Context.getConstantArrayType(elementType, ConstVal, + ArrayType::Normal, 0); } } |