| 1 |
// https://github.com/dlang/dmd/issues/18127 |
| 2 |
// struct in here, union in other |
| 3 |
struct struct_or_union { |
| 4 |
int x; |
| 5 |
}; |
| 6 |
|
| 7 |
// mismatching number of fields |
| 8 |
struct S_n_fields { |
| 9 |
int x; |
| 10 |
}; |
| 11 |
|
| 12 |
// mismatched types |
| 13 |
struct S_types { |
| 14 |
int x; |
| 15 |
}; |
| 16 |
|
| 17 |
// mismatched names |
| 18 |
struct S_names { |
| 19 |
float y; |
| 20 |
}; |
| 21 |
|
| 22 |
struct B { |
| 23 |
float 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 |
float x; |
| 35 |
} a; |
| 36 |
}; |
| 37 |
|
| 38 |
struct S_contains_anon_unnamed { |
| 39 |
struct { |
| 40 |
float x; |
| 41 |
}; |
| 42 |
}; |
| 43 |
|
| 44 |
// bitfields |
| 45 |
struct S_bitfields_mismatch1 { |
| 46 |
unsigned x: 3; |
| 47 |
unsigned y; |
| 48 |
}; |
| 49 |
struct S_bitfields_mismatch2 { |
| 50 |
unsigned x: 3; |
| 51 |
unsigned y: 1; |
| 52 |
}; |
| 53 |
|
| 54 |
struct S_bitfields_widths { |
| 55 |
unsigned x: 3; |
| 56 |
unsigned y: 2; |
| 57 |
}; |
| 58 |
|
| 59 |
struct S_bitfields_anon { |
| 60 |
unsigned x: 3; |
| 61 |
unsigned y: 1; |
| 62 |
}; |
| 63 |
|
| 64 |
// mismatched alignment |
| 65 |
struct S_alignas { |
| 66 |
float x; |
| 67 |
}; |
| 68 |
struct S_aligned { |
| 69 |
float x; |
| 70 |
}__attribute__((aligned(4))); |
| 71 |
|
| 72 |
// mismatched packing |
| 73 |
struct S_pack_1 { |
| 74 |
float x; |
| 75 |
char c; |
| 76 |
}; |
| 77 |
struct S_pack_2 { |
| 78 |
float x; |
| 79 |
char c; |
| 80 |
}; |