mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 05:30:13 +03:00
fix Issue 23346 - ImportC: pragma pack is not popped (#14490)
This commit is contained in:
parent
e5e181862b
commit
2f5f62287f
2 changed files with 47 additions and 1 deletions
32
compiler/test/compilable/test22346.c
Normal file
32
compiler/test/compilable/test22346.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* DISABLED: win32 win64 linux32 osx32 osx64 freebsd32
|
||||
*/
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=23346
|
||||
|
||||
#pragma pack(pop) // do nothing
|
||||
|
||||
struct NotPacked1 {
|
||||
int x;
|
||||
long y;
|
||||
};
|
||||
|
||||
#pragma pack(push, 4)
|
||||
struct Packed {
|
||||
int x;
|
||||
long y;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
struct NotPacked {
|
||||
int x;
|
||||
long y;
|
||||
};
|
||||
|
||||
int x[3] = {
|
||||
sizeof(struct NotPacked1),
|
||||
sizeof(struct Packed),
|
||||
sizeof(struct NotPacked) };
|
||||
|
||||
_Static_assert(sizeof(struct NotPacked1) == 16, "1");
|
||||
_Static_assert(sizeof(struct Packed) == 12, "2");
|
||||
_Static_assert(sizeof(struct NotPacked ) == 16, "3");
|
Loading…
Add table
Add a link
Reference in a new issue