October 05 [Issue 24797] New: isZeroInit is wrongly false for some struct/union nesting | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24797 Issue ID: 24797 Summary: isZeroInit is wrongly false for some struct/union nesting Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: minor Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: nick@geany.org 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 -- |
Copyright © 1999-2021 by the D Language Foundation