c++: Implement for namespace statics CWG 2867 - Order of initialization for structure...
[official-gcc.git] / gcc / testsuite / gcc.dg / gnu23-tag-alias-1.c
blobc51417f831a808e2f9ae01eb66b3130731de9268
1 /* { dg-do run }
2 * { dg-options "-std=gnu23 -O2" }
3 */
5 /* Check that structs with flexible array member can alias. */
7 struct bar { int x; int f[]; };
9 [[gnu::noinline,gnu::noipa]]
10 int test_bar2(struct bar* a, void* b)
12 a->x = 1;
14 struct bar { int x; int f[0]; }* p = b;
15 struct bar* q = a;
16 p->x = 2;
18 return a->x;
23 int main()
25 struct bar z;
27 if (2 != test_bar2(&z, &z))
28 __builtin_abort();
30 return 0;