[Issue 9999] Integer literal 0 and 1 should prefer integer type in overload resolution

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 25 16:35:46 UTC 2021


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

Paul Backus <snarwin+bugzilla at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |snarwin+bugzilla at gmail.com

--- Comment #23 from Paul Backus <snarwin+bugzilla at gmail.com> ---
> At the very least, 1 -> true should match as an implicit conversion, not an exact match (in which case, one gets an overload resolution error rather than a bug).

In this example, both `1 -> long` and `1 -> bool` are implicit conversions, so
partial ordering is used, and `1 -> bool` is correctly selected as the
more-specialized implicit conversion.

The only thing one can really object to here is that the `1 -> bool` conversion
is allowed in the first place. But since DIP 1015 has been rejected, it seems
like that objection has been overruled, so there is (unfortunately) nothing
left to be done here.

--


More information about the Digitalmars-d-bugs mailing list