Debian Codegraph @

gcc/testsuite/g++.dg/ext/builtin-clear-padding-1.C

raw
1 // PR middle-end/97943
2 // { dg-do compile }
3 // { dg-options "" }
4
5 struct S { int a; char b[] __attribute__((aligned (2 * sizeof (int)))); }; // { dg-error "flexible array member 'S::b' not at end of 'struct \[TV]'" }
6 struct T { int a; struct S b; int c; }; // { dg-message "next member 'int T::c' declared here|in the definition of 'struct T'" }
7 union U { int a; struct S b; };
8 struct V { int a; union U b; int : 15; int c; }; // { dg-message "next member 'int V::c' declared here|in the definition of 'struct V'" }
9
10 void
11 foo (struct T *t, struct V *v)
12 {
13 __builtin_clear_padding (t); // { dg-error "flexible array member 'S::b' does not have well defined padding bits for '__builtin_clear_padding'" }
14 __builtin_clear_padding (v); // { dg-error "flexible array member 'S::b' does not have well defined padding bits for '__builtin_clear_padding'" }
15 }