www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20754] New: Aggregates inherit alignment of its members

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 puremagic.com
          Reporter: Bastiaan 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); } ``` --
Apr 20 2020