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

Reply via email to