c++: Implement for namespace statics CWG 2867 - Order of initialization for structure...
[official-gcc.git] / gcc / testsuite / gcc.dg / builtin-object-size-12.c
blobe29dd17d61128de7a499b6402e7bff125f3824c9
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
4 #include "builtin-object-size-common.h"
6 struct S {
7 int len;
8 char s[0];
9 };
10 int main()
12 char buf[sizeof (struct S) + 32];
13 if (__builtin_object_size (((struct S *)&buf[0])->s, 1) != 32)
14 FAIL ();
15 if (__builtin_object_size (((struct S *)&buf[1])->s, 1) != 31)
16 FAIL ();
17 if (__builtin_object_size (((struct S *)&buf[64])->s, 0) != 0)
18 FAIL ();
20 DONE ();