[Issue 24776] New: Struct with anonymous union has wrong isZeroInit

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 20 16:08:54 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24776

          Issue ID: 24776
           Summary: Struct with anonymous union has wrong isZeroInit
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: nick at geany.org

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.

--


More information about the Digitalmars-d-bugs mailing list