diff --git a/compiler/test/compilable/test21271.c b/compiler/test/compilable/test21271.c new file mode 100644 index 0000000000..732fa8b75d --- /dev/null +++ b/compiler/test/compilable/test21271.c @@ -0,0 +1,16 @@ +// https://github.com/dlang/dmd/issues/21271 +#define PUSH __pragma(pack(push)) +#define PACK __pragma(pack(1)) +#define POP __pragma(pack(pop)) + +PUSH +PACK +struct S21271_1 { + int x; +}; +_Static_assert(_Alignof(struct S21271_1)==1, "1"); +POP +struct S21271_2 { + int x; +}; +_Static_assert(_Alignof(struct S21271_2)==_Alignof(int), "2"); diff --git a/druntime/src/importc.h b/druntime/src/importc.h index 9d8ceff4f0..cdcf830d20 100644 --- a/druntime/src/importc.h +++ b/druntime/src/importc.h @@ -59,7 +59,7 @@ #define __forceinline __attribute__((always_inline)) #undef _Check_return_ //#define _Check_return_ -#define __pragma(x) +#define __pragma(x) _Pragma(#x) #undef _GLIBCXX_USE_FLOAT128