[Issue 20754] New: Aggregates inherit alignment of its members
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 20 15:40:08 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20754
Issue ID: 20754
Summary: Aggregates inherit alignment of its members
Product: D
Version: D2
Hardware: x86
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: Bastiaan at Veelo.net
>From 2.074.1 and onward, this fails:
```
struct S
{
align (1):
byte a;
int b;
long c;
}
void main()
{
assert(S.sizeof == 16);
}
```
which in violation of the specification:
https://dlang.org/spec/attribute.html#align
The actual size returned by the affected versions is 13, which according to the
spec would require specifying the alignment on the struct itself as well:
```
align (1) struct S
{
align (1):
byte a;
int b;
long c;
}
void main()
{
assert(S.sizeof == 13);
}
```
--
More information about the Digitalmars-d-bugs
mailing list