enum Status : byte { A, B, C } void main() { } Status foo() { Status t = Status.A; const Status s = t; return (s == Status.A) ? Status.B : s; // <-- here } # dmd app.d app.d(16): Error: cannot implicitly convert expression `cast(int)s == 0 ? 1 : cast(int)s` of type `int` to `Status` ///////////////////////////////////////// So there's no problem: Status foo() { Status t = Status.A; const Status s = t; if (s == Status.A) return Status.B; return s; }
https://issues.dlang.org/show_bug.cgi?id=23172 It should be the same problem.
yes it is, there's an inapropriate integral promotion since 2.100.0 *** This issue has been marked as a duplicate of issue 23172 ***