Bug 22256 – casting int from struct member to enum fails at compile time

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-08-30T22:53:56Z
Last change time
2024-12-13T19:18:12Z
Assigned to
No Owner
Creator
Dennis
Moved to GitHub: dmd#19977 →

Comments

Comment #0 by dkorpel — 2021-08-30T22:53:56Z
``` enum E { e } struct S { int s; } enum E e1 = cast(E) S(0).s; ``` onlineapp.d(7,23): Error: cannot implicitly convert expression `0` of type `int` to `E` This should compile, but dmd for some reason wants to convert `0` to `E` in the constructor of `S`.
Comment #1 by robert.schadek — 2024-12-13T19:18:12Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19977 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB