bool <=> int. WTF. (DIP0015)
jmh530
john.michael.hall at gmail.com
Tue Jul 2 15:10:37 UTC 2019
On Tuesday, 2 July 2019 at 13:42:28 UTC, 9il wrote:
> [snip]
>
> Looks like a serious bug to me. Please report it at
> https://issues.dlang.org/
According to the section on function overloading [1], this is a
"match with implicit conversions." Numeric literals like 0 and 1
can be implicitly converted to bool [2], so that isn't a bug,
even if it is confusing in this case.
I think people could disagree on whether the enum part of the
example is a bug. Maybe more of an enhancement request to have
different handling for function overloads with enums? The enum
values are being treated like literals instead of as ints.
[1] https://dlang.org/spec/function.html#function-overloading
[2] https://dlang.org/spec/type.html#bool
More information about the Digitalmars-d
mailing list