← Back to index
|
Original Bugzilla link
Bug 19817 – Incorrect common type for const enum and mutable enum when sized
Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-04-22T09:34:54Z
Last change time
2024-12-13T19:03:09Z
Assigned to
No Owner
Creator
Eyal
Moved to GitHub: dmd#19558 →
Comments
Comment #0
by eyal — 2019-04-22T09:34:54Z
This works: { enum E1 { A } E1 a; const(E1) b; static assert(is(typeof(a) == E1)); static assert(is(typeof(b) == const(E1))); static assert(is(typeof(1 ? a : b) == const(E1))); } but this doesn't, as unify of const(E2) and E2 is not E2, but int: { enum E2 : ubyte { A } E2 a; const(E2) b; static assert(is(typeof(a) == E2)); static assert(is(typeof(b) == const(E2))); static assert(is(typeof(1 ? a : b) == const(E2))); // Error: static assert: `is(int == const(E2))` is false }
Comment #1
by kubo39 — 2019-04-24T03:28:38Z
In E2 case, typeof(1 ? a : b) is converted to typeof(1 ? cast(int)a : cast(int)b).
Comment #2
by robert.schadek — 2024-12-13T19:03:09Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/dmd/issues/19558
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB