DIP 1015--Deprecation of Implicit Conversion of Int. & Char. Literals to bool--Formal Assement
12345swordy
alexanderheistermann at gmail.com
Tue Nov 13 17:53:27 UTC 2018
On Tuesday, 13 November 2018 at 17:50:20 UTC, Neia Neutuladh
wrote:
> On Tue, 13 Nov 2018 09:46:17 -0500, Steven Schveighoffer wrote:
>> Maybe the biggest gripe here is that enums don't prefer their
>> base types over what their base types convert to. In the
>> developer's mind, the conversion is:
>>
>> A => int => (via VRP) short
>>
>> which seems more complex than just
>>
>> A => int
>
> It affects explicit casts too:
>
> void foo(short a) { writefln("short %s", a); }
> void foo(int a) { writefln("int %s", a); }
> foo(cast(int)0); // prints: short 0
>
Ok, now that has got to be a bug. If you explicit cast the number
to an integer then you expect the overload function with int to
be called.
-Alex
More information about the Digitalmars-d-announce
mailing list