mirror of
https://github.com/dlang/dmd.git
synced 2025-04-25 20:50:41 +03:00

Fixes: https://github.com/dlang/dmd/issues/18127 When merging struct definitions from different C imports, check that the structs are actually compatible according to the C rules. If they are not, issue an error.
74 lines
951 B
C
74 lines
951 B
C
// https://github.com/dlang/dmd/issues/18127
|
|
union struct_or_union {
|
|
int x;
|
|
};
|
|
|
|
struct S_n_fields {
|
|
int x, y;
|
|
};
|
|
|
|
struct S_types {
|
|
float x;
|
|
};
|
|
|
|
struct S_names {
|
|
float x;
|
|
};
|
|
|
|
struct B {
|
|
int x;
|
|
};
|
|
|
|
struct S_b {
|
|
struct B b;
|
|
};
|
|
|
|
struct S_contains_anon_named {
|
|
struct {
|
|
int x;
|
|
} a;
|
|
};
|
|
|
|
struct S_contains_anon_unnamed {
|
|
struct {
|
|
int x;
|
|
};
|
|
};
|
|
|
|
struct S_bitfields_mismatch1 {
|
|
unsigned x: 3;
|
|
unsigned y: 1;
|
|
};
|
|
struct S_bitfields_mismatch2 {
|
|
unsigned x;
|
|
unsigned y: 1;
|
|
};
|
|
|
|
struct S_bitfields_widths {
|
|
unsigned x: 3;
|
|
unsigned y: 1;
|
|
};
|
|
|
|
struct S_bitfields_anon {
|
|
unsigned x: 3;
|
|
unsigned : 1;
|
|
};
|
|
|
|
struct S_alignas {
|
|
_Alignas(8) float x;
|
|
};
|
|
struct S_aligned {
|
|
float x;
|
|
}__attribute__((aligned(8)));
|
|
|
|
struct __attribute__((packed)) S_pack_1 {
|
|
float x;
|
|
char c;
|
|
};
|
|
#pragma pack(push)
|
|
#pragma pack(1)
|
|
struct S_pack_2 {
|
|
float x;
|
|
char c;
|
|
};
|
|
#pragma pack(pop)
|