[Issue 14802] Template argument deduction depends on order of arguments
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Jul 16 08:18:17 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14802
--- Comment #5 from Ivan Timokhin <timokhin.iv at gmail.com> ---
(In reply to Steven Schveighoffer from comment #4)
> ...
>
> However, for double/float:
>
> f!double(1.0, 1.0f) and f!float(1.0, 1.0f) both compile.
>
> Decision is necessarily arbitrary because both can compile. To make the
> decision "consistent" is not necessarily a bug fix, I can see how the
> compiler is free to arbitrarily decide which type to use.
>
> ...
Or it can reject the call as ambiguous (or prefer double as it does in other
cases). As a matter of fact, that's what it does if f(float, float) and
f(double, double) are defined explicitly, instead of being generated by
template instantiation.
--
More information about the Digitalmars-d-bugs
mailing list