Fixes #20587 - Add align(default) (#20589)

This commit is contained in:
Quirin F. Schroll 2024-12-30 06:02:14 +01:00 committed by GitHub
parent b88ffc50d7
commit 3f90de47c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 58 additions and 4 deletions

View file

@ -0,0 +1,28 @@
struct S
{
align(1)
{
short x1;
int y1;
long z1;
align(default)
{
short x;
int y;
long z;
}
}
}
void fun()
{
static assert(S.x1.alignof == 1);
static assert(S.y1.alignof == 1);
static assert(S.z1.alignof == 1);
static assert(S.x.alignof == short.alignof);
static assert(S.y.alignof == int.alignof);
static assert(S.z.alignof == long.alignof);
}