1 /* Test for constant expressions: VLA size constraints. */
2 /* Origin: Joseph Myers <joseph@codesourcery.com> */
3 /* { dg-do compile } */
4 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
9 /* An array size that is a constant expression, not just an integer
10 constant expression, must be checked for being positive, but only
11 an integer constant expression makes it not a VLA (which affects
12 certain compatibility checks, in particular). */
13 int a1[0]; /* { dg-error "zero" } */
14 int a2[-1]; /* { dg-error "negative" } */
15 int a3[(int)(double)0.0]; /* { dg-error "zero" } */
16 int a4[(int)-1.0]; /* { dg-error "negative" } */
19 void *p = (m ? &a5 : &a6);
22 void *q = (m ? &a7 : &a8); /* { dg-error "pointer type mismatch in conditional expression" } */