On Sunday, 16 February 2025 at 05:39:07 UTC, Jonathan M Davis
wrote:
_especially_ when VRP comes into play, because then you get
nonsense like foo(1) calling the bool overload.
I have often seen this mentioned, but I only see this happen if
there *isn't* an integer overload i.e. this...
```d
//void foo(int x) { writeln("I"); } //Comment to remove 'int'
overload
void foo(long x) { writeln("L"); }
void foo(ulong x) { writeln("UL"); }
void foo(bool x) { writeln("B"); }
void main()
{
foo(17UL);
foo(1);
foo(true);
}
```
...will output:
UL
B
B
But if you uncomment the 'int' overload, you get...
UL
I
B
...which is what I would expect. Or am I misunderstanding your
point? With the 'int' overload commented, are you arguing it
should match the best overloaded type that can VRP from 'int',
such as 'long' above?