[Issue 21460] implicit conversion between two unrelated enum is accepted
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 8 21:23:20 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21460
--- Comment #3 from Basile-z <b2.temp at gmx.com> ---
The promotion of a switch condition should be done after checking the cases.
Then a second pass should be done on the CaseStatement expressions to
implicitly cast them to the, eventually promoted, condition. Which should never
be a problem.
This is specifically and **definitively** a front-end bug on the
SwitchStatement as for example
---
enum Good : ubyte { a = 1 }
enum Bad : ubyte { a = 2 }
void main(string[] args)
{
Good good;
if (good == Bad.a){}
}
---
is rejected. As the cases of a switch should be.
--
More information about the Digitalmars-d-bugs
mailing list