1 /* Test C23 support for empty initializers: invalid use cases. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c23 -pedantic-errors" } */
5 /* Empty initialization is invalid for arrays of unknown size. This is
6 diagnosed via the diagnostic for zero-size arrays. */
7 int x
[] = {}; /* { dg-error "zero or negative size array" } */
12 int x1
[] = {}; /* { dg-error "zero or negative size array" } */
13 int x2
[][a
] = {}; /* { dg-error "zero or negative size array" } */
14 /* Nonempty VLA initializers are still invalid. */
15 int x3
[a
] = { 0 }; /* { dg-error "variable-sized object may not be initialized except with an empty initializer" } */
16 /* Variable-size compound literals are still invalid. */
17 (void) (int [a
]) {}; /* { dg-error "compound literal has variable size" } */