On Tuesday, 14 November 2017 at 13:43:32 UTC, Michael V. Franklin 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.

Well, of course it's not related; it's a char not a bool. But there does seem to be some systematic problems in D's implicit conversion rules. I'll have to investigate this and perhaps I can address them both in one DIP.

Mike


Reply via email to