Bug 23534 – __traits(isZeroInit) is true for enums with explicit values

Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2022-12-02T04:38:41Z
Last change time
2022-12-02T11:57:22Z
Keywords
pull
Assigned to
No Owner
Creator
Teodor Dutu

Comments

Comment #0 by teodor.dutu — 2022-12-02T04:38:41Z
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.
Comment #1 by dlang-bot — 2022-12-02T10:54:46Z
@RazvanN7 created dlang/dmd pull request #14666 "Fix Issue 23534 - __traits(isZeroInit) is true for enums with explicit values" fixing this issue: - Fix Issue 23534 - __traits(isZeroInit) is true for enums with explicit values https://github.com/dlang/dmd/pull/14666
Comment #2 by dlang-bot — 2022-12-02T11:57:22Z
dlang/dmd pull request #14666 "Fix Issue 23534 - __traits(isZeroInit) is true for enums with explicit values" was merged into master: - 60e9606fc6cdb4a72c2345dde3c76a6c0578892d by RazvanN7: Fix Issue 23534 - __traits(isZeroInit) is true for enums with explicit values https://github.com/dlang/dmd/pull/14666