[Issue 23534] New: __traits(isZeroInit) is true for enums with explicit values

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 2 04:38:41 UTC 2022


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

          Issue ID: 23534
           Summary: __traits(isZeroInit) is true for enums with explicit
                    values
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: teodor.dutu at gmail.com

The second assert in the following code fails despite E.init being a, not 0.

enum E { a = 1, b = 2 }
void main()
{
    assert(E.init != cast(E) 0);
    assert(!__traits(isZeroInit, E)); // this fails
}

This partially blocks https://github.com/dlang/dmd/pull/14664.

--


More information about the Digitalmars-d-bugs mailing list