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

Nick Treleaven nick at geany.org
Tue Nov 14 13:20:22 UTC 2017


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



More information about the Digitalmars-d mailing list