Bug 23081 – align(N) attribute ignored for ClassDeclarations

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-05-02T19:38:37Z
Last change time
2024-12-13T19:22:34Z
Assigned to
No Owner
Creator
kinke
Moved to GitHub: dmd#18102 →

Comments

Comment #0 by kinke — 2022-05-02T19:38:37Z
`align(N) class C {}` has no effect at all. I'd expect the following behavior: ``` align(64) class AlignedClass { int field; } static assert(AlignedClass.field.offsetof == 2 * size_t.sizeof); // vtbl, monitor static assert(__traits(classInstanceAlignment, AlignedClass) == 64); static assert(__traits(classInstanceSize, AlignedClass) == 2 * size_t.sizeof + 4); ``` See https://github.com/dlang/dmd/pull/14063#issuecomment-1115059532 for an implementation idea.
Comment #1 by dlang-bot — 2022-05-02T19:44:32Z
@kinke updated dlang/dmd pull request #14063 "Add __traits(classInstanceAlignment)" mentioning this issue: - [remove `align(N) class C {}` tests - no ClassDeclaration.alignment field] Filed as issue 23081. https://github.com/dlang/dmd/pull/14063
Comment #2 by dlang-bot — 2022-05-13T08:55:09Z
dlang/dmd pull request #14063 "Add __traits(classInstanceAlignment)" was merged into master: - cf3add4c2ca142d4ce6cfe2dac6a84b41f398c5c by Martin Kinkelin: [remove `align(N) class C {}` tests - no ClassDeclaration.alignment field] Filed as issue 23081. https://github.com/dlang/dmd/pull/14063
Comment #3 by robert.schadek — 2024-12-13T19:22:34Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18102 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB