Rename Sema::isConstantArrayType -> VerifyConstantArrayType. Make sure to
check canonical types in a few places. Tighten up VerifyConstantArrayType to diagnose more errors, now that we can evaluate i-c-e's. Add some fixmes about poor diagnostics. We now correctly typecheck this example: void s(void) { typedef int a[(int) +1.0]; static a b; // invalid, static VLA static int c[(int) +1.0]; // invalid, static VLA } void t(void) { typedef int a[(int)1.0]; static a b; // valid, constant size } void u() { static int X[-1]; static int Y[0]; } producing: static-vla.c:3:12: error: variable length array declared outside of any function static a b; // invalid, static VLA ^ static-vla.c:5:14: error: variable length array declared outside of any function static int c[(int) +1.0]; // invalid, static VLA ^ ~~~~~~~~~~ static-vla.c:15:14: error: array size is negative static int X[-1]; ^ ~~ static-vla.c:16:14: warning: zero size arrays are an extension static int Y[0]; ^ ~ llvm-svn: 39587
Loading
Please register or sign in to comment