mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00

Resolves https://github.com/dlang/dmd/issues/20434 Allowing this gnu/clang extension actually removes lines of code as we can unify the parsing and semantics of `_Alignof` and `sizeof` and have the normal D machinery handle the difference later.
18 lines
339 B
C
18 lines
339 B
C
// Test _Alignas
|
|
|
|
int printf(const char *, ...);
|
|
|
|
_Alignas(4) _Alignas(8) _Alignas(0) int x = 5;
|
|
_Static_assert(_Alignof(x) == 8, "in");
|
|
|
|
_Alignas(int) short y = 6;
|
|
_Static_assert(_Alignof(y) == 4, "in");
|
|
|
|
struct S
|
|
{
|
|
_Alignas(2) char d;
|
|
_Alignas(int) char c;
|
|
};
|
|
|
|
struct S s = { 1, 2 };
|
|
_Static_assert(sizeof(struct S) == 8, "in");
|