Debian Codegraph @

tests/dmd/fail_compilation/imports/imp18127a.c

raw
1 // https://github.com/dlang/dmd/issues/18127
2 // union in here, struct in other
3 union struct_or_union {
4 int x;
5 };
6
7 // mismatching number of fields
8 struct S_n_fields {
9 int x, y;
10 };
11
12 // mismatched types
13 struct S_types {
14 float x;
15 };
16
17 // mismatched names
18 struct S_names {
19 float x;
20 };
21
22 struct B {
23 int x;
24 };
25
26 // Contains a struct that is incompatible
27 struct S_b {
28 struct B b;
29 };
30
31 // mismatched anonymous struct
32 struct S_contains_anon_named {
33 struct {
34 int x;
35 } a;
36 };
37
38 struct S_contains_anon_unnamed {
39 struct {
40 int x;
41 };
42 };
43
44 // bitfields
45 struct S_bitfields_mismatch1 {
46 unsigned x: 3;
47 unsigned y: 1;
48 };
49 struct S_bitfields_mismatch2 {
50 unsigned x;
51 unsigned y: 1;
52 };
53
54 struct S_bitfields_widths {
55 unsigned x: 3;
56 unsigned y: 1;
57 };
58
59 struct S_bitfields_anon {
60 unsigned x: 3;
61 unsigned : 1;
62 };
63
64 // mismatched alignment
65 struct S_alignas {
66 _Alignas(8) float x;
67 };
68 struct S_aligned {
69 float x;
70 }__attribute__((aligned(8)));
71
72 // mismatched packing
73 struct __attribute__((packed)) S_pack_1 {
74 float x;
75 char c;
76 };
77 #pragma pack(push)
78 #pragma pack(1)
79 struct S_pack_2 {
80 float x;
81 char c;
82 };
83 #pragma pack(pop)