Bug 17857 – T.alignof ignores explicit align(N) type alignment

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-09-25T21:59:26Z
Last change time
2021-06-08T12:54:47Z
Assigned to
No Owner
Creator
kinke

Comments

Comment #0 by kinke — 2017-09-25T21:59:26Z
T.alignof currently always returns the natural alignment of a type: align(8) struct Aligned { int a; } static assert(Aligned.alignof == 8); // fails, 4 align(1) struct Packed { int a; } static assert(Packed.alignof == 1); // fails, 4 Fix: https://github.com/dlang/dmd/pull/7164
Comment #1 by github-bugzilla — 2017-09-27T22:37:36Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/9e3fad9ea3e955b10ec80439247e50fc9417f77d T.alignof: Respect explicit align(N) type alignment It was previously the natural type alignment, defined as the maximum of the field alignments for an aggregate. Make sure an explicit `align(N)` overrides it. fix Issue 17857 https://github.com/dlang/dmd/commit/30f0fe23961a194c9789ab32368ef50b4257c0dd Merge pull request #7164 from kinke/alignof fix Issue 17857 - T.alignof ignores explicit align(N) type alignment
Comment #2 by github-bugzilla — 2017-10-16T09:57:48Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/9e3fad9ea3e955b10ec80439247e50fc9417f77d T.alignof: Respect explicit align(N) type alignment https://github.com/dlang/dmd/commit/30f0fe23961a194c9789ab32368ef50b4257c0dd Merge pull request #7164 from kinke/alignof
Comment #3 by dlang-bot — 2021-06-08T12:54:47Z
dlang/dmd pull request #12646 "[dmd-cxx] T.alignof: Respect explicit align(N) type alignment" was merged into dmd-cxx: - 1290f31f512f0734398a423bde96f1d9b3dbdea0 by Martin: [dmd-cxx] T.alignof: Respect explicit align(N) type alignment It was previously the natural type alignment, defined as the maximum of the field alignments for an aggregate. Make sure an explicit `align(N)` overrides it. fix Issue 17857 https://github.com/dlang/dmd/pull/12646