[Issue 14269] Enum is not implicitly converted to base type when using ref

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Mar 10 11:51:07 PDT 2015


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

--- Comment #14 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Ali Cehreli from comment #13)
> If the implicitly-converted value is an rvalue (as it is), where is it
> stored to take the reference of?

No, an enum is a derivative. It's just like you can pass a class reference as
Object without consequence. Where you run into issues is if you have a
REFERENCE to a class reference.

So the implicit casting is not because enum converts to long (for example),
it's because enum IS a long.

And in addition, enum does not allow you to really treat it any differently
than the base type. You can't add any features that "wouldn't work" for a long,
for instance.

--


More information about the Digitalmars-d-bugs mailing list