April 22, 2019 [Issue 19817] New: Incorrect common type for const enum and mutable enum when sized | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: eyal@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 } -- |
Copyright © 1999-2021 by the D Language Foundation