Debian Codegraph @

gcc/testsuite/gcc.dg/pr119350-1.c

raw
1 /* PR c/119350 */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c23 -pedantic-errors" } */
4
5 struct S { int a; int b[]; };
6 struct T { struct S c; }; /* { dg-error "invalid use of structure with flexible array member" } */
7 struct S d = { 1, {} }; /* { dg-error "initialization of a flexible array member" } */
8 struct S e = { 1, { 2 } }; /* { dg-error "initialization of a flexible array member" } */
9 struct S f = { .a = 1, .b = {} }; /* { dg-error "initialization of a flexible array member" } */
10 struct S g = { .a = 1, .b = { 2 } }; /* { dg-error "initialization of a flexible array member" } */
11 struct T h = { { 1, {} } }; /* { dg-error "initialization of flexible array member in a nested context" } */
12 struct T i = { { 1, { 2 } } }; /* { dg-error "initialization of flexible array member in a nested context" } */
13 struct T j = { .c = { .a = 1, .b = {} } }; /* { dg-error "initialization of flexible array member in a nested context" } */
14 struct T k = { .c = { .a = 1, .b = { 2 } } }; /* { dg-error "initialization of flexible array member in a nested context" } */