It seems a cast does more than change the static type and VRP.
```d
void foo(uint) { }

int x = -1;
foo(x); // compiles (debatable)
foo(long(x)); // compiles(!)
foo(cast(long)x); // compiles(!)
foo((() => cast(long)x)()); // Error: foo is not callable using argument types […]
```

Why do the latter two work? Their static type is `long` which normally rules out conversion to `uint`. However, if VRP can prove the value is definitely in the range of `uint`, the implicit conversion to `uint` is possible. However, VRP shouldn’t say that that’s the case, since `int` supports negative numbers and `uint` doesn’t.

Reply via email to