Debian Codegraph @

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

raw
1 /* REQUIRED_ARGS: -preview=bitfields
2 * TEST_OUTPUT:
3 ---
4 fail_compilation/biterrors5.d(23): Error: bitfield symbol expected not struct `biterrors5.S`
5 fail_compilation/biterrors5.d(24): Error: bitfield symbol expected not variable `biterrors5.test0.i`
6 ---
7 */
8
9 struct S
10 {
11 int a,b;
12 int :2, c:3;
13 }
14
15 static assert(__traits(getBitfieldOffset, S.b) == 0);
16 static assert(__traits(getBitfieldWidth, S.b) == 32);
17 static assert(__traits(getBitfieldOffset, S.c) == 2);
18 static assert(__traits(getBitfieldWidth, S.c) == 3);
19
20 void test0()
21 {
22 int i;
23 i = __traits(getBitfieldOffset, S);
24 i = __traits(getBitfieldOffset, i);
25 }