Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/dbitfields.d

raw
1 /* REQUIRED_ARGS: -preview=bitfields
2 * TEST_OUTPUT:
3 ---
4 fail_compilation/dbitfields.d(118): Error: reinterpretation through overlapped field `e` is not allowed in CTFE
5 fail_compilation/dbitfields.d(121): called from here: `testu()`
6 fail_compilation/dbitfields.d(121): while evaluating: `static assert(testu() == 1)`
7 ---
8 */
9
10 #line 100
11
12 union U
13 {
14 uint a:3;
15 uint b:1;
16 ulong c:64;
17
18 int d:3;
19 int e:1;
20 long f:64;
21
22 int i;
23 }
24
25 int testu()
26 {
27 U u;
28 u.d = 9;
29 return u.e;
30 }
31
32 static assert(testu() == 1);