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,23 @@
The `align` attribute now allows to specify `default` explicitly
A lone `align` sets the alignment to the types default.
Alternatively, to be more explicit, `align(default)` does the same.
```
struct S
{
align(4)
{
byte x;
align(default) long y;
long z;
}
}
void main()
{
pragma(msg, S.x.alignof); // 4
pragma(msg, S.y.alignof); // 8
pragma(msg, S.z.alignof); // 4
}
```