Deprecate implicit `int` to `bool` conversion for integer literals

Michael V. Franklin slavo5150 at yahoo.com
Tue Nov 14 13:43:32 UTC 2017


On Tuesday, 14 November 2017 at 13:32:52 UTC, Andrei Alexandrescu 
wrote:

>> An very similar problem exists for int and char overloads:
>> 
>> alias foo = (char c) => 1;
>> alias foo = (int i) => 4;
>> 
>> enum int e = 7;
>> static assert(foo(e) == 4); // fails
>
> Thanks. Addressing this should be part of the DIP as well. --

It doesn't appear to be related to the implicit conversion of 
integer literals to bool.  While Andrei's example is fixed by by 
deprecating implicit conversion of integral literals to bool (at 
least using this implementation: 
https://github.com/dlang/dmd/pull/7310), Nick's example isn't.

Nick, if it's not in bugzilla already, can you please add it?

Mike




More information about the Digitalmars-d mailing list