https://issues.dlang.org/show_bug.cgi?id=21460
--- Comment #1 from Basile-z <[email protected]> --- This is caused by the automatic integer promotion on the condition. It is done before evaluation of the cases so it "mind-fuck" the type checks that are correct when no promotion is involved: --- enum Good { a = 1 } enum Bad { a = 2 } void main() { Good good; switch (good) // no promotion { case Bad.a : break; // error as expected default: } } --- VS --- enum Good : ubyte { a = 1 } enum Bad : ubyte { a = 2 } void main() { Good good; switch (good) // by promotion replaced by 'cast(int) good' { case Bad.a : break; // OK because convert to int default: } } --- --
