Deprecate implicit `int` to `bool` conversion for integer literals
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Nov 14 13:32:52 UTC 2017
On 11/14/17 8:20 AM, Nick Treleaven wrote:
> On Sunday, 12 November 2017 at 16:57:05 UTC, Andrei Alexandrescu wrote:
>> The overload being called depends on (a) whether a - b can be computed
>> during compilation or not, and (b) the actual value of a - b. Clearly
>> a big problem for modular code. This is the smoking gun motivating the
>> DIP.
>
> 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. -- Andrei
More information about the Digitalmars-d
mailing list