[Issue 19817] New: Incorrect common type for const enum and mutable enum when sized
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 22 09:34:54 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19817
Issue ID: 19817
Summary: Incorrect common type for const enum and mutable enum
when sized
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: eyal at weka.io
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
}
--
More information about the Digitalmars-d-bugs
mailing list