On Saturday, 19 March 2016 at 17:40:27 UTC, Lass Safin wrote:
Why:
enum Base {
A,
B,
}
enum Derived : Base {
C, // Gives error, says it can't implicitly convert
expression to Base.
D = 1, // Same error
E = cast(Base)294, // Finally works. Can only be
cast(Derived) instead.
}
void func(Derived d) {}
func(Derived.E); // works.
func(Derived.A); // Gives error, says it can't call function
with Base.A.
func(cast(Derived)Derived.A); // Works.
So, what's the proper way of extending an enum?
Meant "Can also be cast(Derived) instead."