LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / array-6.c
blob6ef64625b964ec73bed3203bd83fde3dfb723a6b
1 /* PR c/5597 */
2 /* { dg-do compile } */
3 /* { dg-options "" } */
5 /* Verify that GCC forbids non-static initialization of
6 flexible array members. */
8 struct str { int len; char s[]; };
10 struct str a = { 2, "a" };
12 void foo()
14 static struct str b = { 2, "b" };
15 struct str c = { 2, "c" }; /* { dg-error "(non-static)|(near initialization)" } */
16 struct str d = (struct str) { 2, "d" }; /* { dg-error "(non-static)|(near initialization)" } */
17 struct str e = (struct str) { d.len, "e" }; /* { dg-error "(non-static)|(initialization)" } */