Bug in function parameters type matching

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 9 14:08:16 PDT 2017


On Saturday, 9 September 2017 at 20:45:59 UTC, EntangledQuanta 
wrote:
> unless enum's are implicitly castable to int's

They are, unless you specify some other base type.

https://dlang.org/spec/enum.html#named_enums

See points 3 and 5 there. It will cast to the base type (int by 
default), but you cannot pass the int as the enum.


> which someone once told me that D didn't like implicit casts 
> because of issues

D has LOTS of implicit casts, including user-defined ones. Some 
are restricted because of issues, but generally speaking, D is 
pretty ok with them.


More information about the Digitalmars-d mailing list