why is this cast required?

Himanshu Sharma sharmahimanshuarysonint at gmail.com
Mon Oct 5 10:19:09 UTC 2026


On Saturday, 26 September 2026 at 19:39:35 UTC, Dejan Lekic wrote:
> On Saturday, 26 September 2026 at 16:49:48 UTC, DanielG wrote:
>> [...]
>
> A function argument generally has to be given a type 
> independent of which parameter type it'll end up matching, 
> because overload resolution needs to compare each argument's 
> own type against every candidate's parameter types to pick the 
> best match — if argument inference depended on "the parameter 
> type of whichever overload gets picked," that's circular. A 
> variable declaration ( `IntFunc[] explicit = [...]` ) doesn't 
> have this problem: there's exactly one destination type, known 
> up front, so the compiler can safely bias the literal toward it.

great information


More information about the Digitalmars-d-learn mailing list