ATI.NumElts = ArraySize = 0;
}
llvm::APSInt ConstVal(32);
- // If no expression was provided, we consider it an incomplete array.
if (!ArraySize) {
T = Context.getIncompleteArrayType(T, ASM, ATI.TypeQuals);
- } else if (!ArraySize->isIntegerConstantExpr(ConstVal, Context)) {
+ } else if (!ArraySize->isIntegerConstantExpr(ConstVal, Context) ||
+ !T->isConstantSizeType()) {
+ // Per C99, a variable array is an array with either a non-constant
+ // size or an element type that has a non-constant-size
T = Context.getVariableArrayType(T, ArraySize, ASM, ATI.TypeQuals);
} else {
// C99 6.7.5.2p1: If the expression is a constant expression, it shall