Debian Codegraph @

gcc/testsuite/g++.dg/ext/flexary25.C

raw
1 // PR c++/81922
2 // { dg-do compile }
3 // { dg-options "" }
4
5 struct S { const char *a; char b[]; };
6 struct T { int a; int b[]; };
7 #if __cplusplus >= 201103L
8 S c[] { "", "" }; // { dg-error "initialization of flexible array member in a nested context" "" { target c++11 } }
9 S d[] { "", { 0 } }; // { dg-error "initialization of flexible array member in a nested context" "" { target c++11 } }
10 T e[] { 1, { 2 }, 3, { 4 } }; // { dg-error "initialization of flexible array member in a nested context" "" { target c++11 } }
11 T f[] { 1, {}, 3, {} };
12 T g { 1, { 1, 2, 3 } };
13 S h { "abcd", "" };
14 #endif
15 S i[] = { "", "", "", "" }; // { dg-error "initialization of flexible array member in a nested context" }
16 S j[] = { "", { 1 }, "", { 2, 3 } }; // { dg-error "initialization of flexible array member in a nested context" }
17 T k[] = { 1, { 2 }, 3, { 4 } }; // { dg-error "initialization of flexible array member in a nested context" }
18 T l[] = { 1, {}, 3, {} };
19 T m = { 1, { 1, 2, 3 } };
20 S n = { "", "abcde" };