[Issue 21460] implicit conversion between two unrelated enum is accepted

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 11 09:21:02 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=21460

Nick Treleaven <nick at geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick at geany.org

--- Comment #5 from Nick Treleaven <nick at geany.org> ---
> Good good;
> switch (good) // by promotion replaced by  'cast(int) good'

Why is an enumeration type promoted to int? Just because it can implicitly
convert doesn't mean it should. The fact that the example with the enums that
don't have a base type do not promote to int shows this is inconsistent.

--


More information about the Digitalmars-d-bugs mailing list