Bug 24797 – isZeroInit is wrongly false for some struct/union nesting

Status
NEW
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-10-05T16:35:25Z
Last change time
2024-12-13T19:37:52Z
Assigned to
No Owner
Creator
Nick Treleaven
Moved to GitHub: dmd#20526 →

Comments

Comment #0 by nick — 2024-10-05T16:35:25Z
The fix for issue 24776 does not catch cases like this: union U3 { int y; struct { float z, w; // z ignored, but w has a different offset to y } } static assert(__traits(isZeroInit, U3)); // fails Using `StructDeclaration.members` rather than `fields` may be necessary as a fallback when there are overlapped fields - see: https://github.com/dlang/dmd/pull/16858#discussion_r1769869617
Comment #1 by robert.schadek — 2024-12-13T19:37:52Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20526 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB