Types soup with enum and bool

bearophile bearophileHUGS at lycos.com
Tue Oct 29 16:49:31 PDT 2013


Maxim Fomin:

> It works according to spec: "A named enum member can be 
> implicitly cast to its EnumBaseType, but EnumBaseType types 
> cannot be implicitly cast to an enum type. "
>
> In this respect D enums behave like C enums.

In C conversion in both directions is allowed (C enums don't have 
a EnumBaseType, well, it's int).

But why are D specs prescribing D enums to be implicitly castable 
to its EnumBaseType?

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list