Bug 24776 – Struct with anonymous union has wrong isZeroInit

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-09-20T16:08:54Z
Last change time
2024-10-05T16:40:11Z
Keywords
pull
Assigned to
No Owner
Creator
Nick Treleaven
See also
https://issues.dlang.org/show_bug.cgi?id=23841

Comments

Comment #0 by nick — 2024-09-20T16:08:54Z
struct S6 { union { int i1; float f1; } } static assert(__traits(isZeroInit, S6)); // fails S6.init should be zero - `{ S6.i1.init }` according to: https://dlang.org/spec/property.html#init PR incoming.
Comment #1 by dlang-bot — 2024-09-20T16:13:12Z
@ntrel created dlang/dmd pull request #16858 "Fix Bugzilla 24776 - Struct with anonymous union has wrong isZeroInit" fixing this issue: - Fix Bugzilla 24776 - Struct with anonymous union has wrong isZeroInit https://github.com/dlang/dmd/pull/16858
Comment #2 by dlang-bot — 2024-10-05T00:56:50Z
dlang/dmd pull request #16858 "Fix: isZeroInit does not take into account unions" was merged into master: - cbb7cb6f3cd2eeed05aca8a2853c17e8829d0d2c by Nick Treleaven: Bugzilla 24776 - Struct with anonymous union has wrong isZeroInit - 179da5d3266fed3e9b3cbd65bf377d4149b31529 by Nick Treleaven: Fix Bugzilla 24776 - Struct with anonymous union has wrong isZeroInit https://github.com/dlang/dmd/pull/16858