diff options
Diffstat (limited to 'test/Sema/vla.c')
-rw-r--r-- | test/Sema/vla.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Sema/vla.c b/test/Sema/vla.c index b9576bf8cfd6..8d83100b9d68 100644 --- a/test/Sema/vla.c +++ b/test/Sema/vla.c @@ -68,3 +68,24 @@ void pr23151(int (*p1)[*]) // expected-error {{variable length array must be bou int TransformBug(int a) { return sizeof(*(int(*)[({ goto v; v: a;})]) 0); // expected-warning {{use of GNU statement expression extension}} } + +// PR36157 +struct { + int a[ // expected-error {{variable length array in struct}} + implicitly_declared() // expected-warning {{implicit declaration}} + ]; +}; +int (*use_implicitly_declared)() = implicitly_declared; // ok, was implicitly declared at file scope + +void VLAPtrAssign(int size) { + int array[1][2][3][size][4][5]; + // This is well formed + int (*p)[2][3][size][4][5] = array; + // Last array dimension too large + int (*p2)[2][3][size][4][6] = array; // expected-warning {{incompatible pointer types}} + // Second array dimension too large + int (*p3)[20][3][size][4][5] = array; // expected-warning {{incompatible pointer types}} + + // Not illegal in C, program _might_ be well formed if size == 3. + int (*p4)[2][size][3][4][5] = array; +} |