November 19, 2004 implicit conversion of complex to real | ||||
---|---|---|---|---|
| ||||
Why such conversion is allowed? I think it is a bug. Moreover, it prevents overloading. At least, give to conversion to complex types more priority. <cfloat_sqrt.d> import std.math; void foo(float a) {} void foo(creal a) {} void main() { cfloat a; cfloat b = sqrt(a); } cfloat_sqrt.d(9): function std.math.sqrt overloads float(float) and creal(creal z) both match argument list for sqrt |
November 19, 2004 Re: implicit conversion of complex to real | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Zaitseff | Ilya Zaitseff wrote:
> Why such conversion is allowed? I think it is a bug.
>
> Moreover, it prevents overloading.
> At least, give to conversion to complex types more priority.
There's no such thing as better or worse overloading matches in D. There are exact matches, implicit conversion matches and non-matches.
We need to turn this into a non-match.
Stewart.
|
Copyright © 1999-2021 by the D Language Foundation