This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Problems with PR 21210
Mark Mitchell wrote:
> 1. Overload resolution
>
> void f(std::complex<double>);
> void f(__complex__ double);
>
> double d;
> ... f(d) ...
>
> which f should get called? Under the semantics I used (conversion
> from double to __complex__ double is a standard conversion) we'd pick
> the second "f". I'd say either we should use the second "f", which
> seems right to me; the other plausible choice would be to consider the
> call ambiguous.
I must be missing something, either technical about the language itself
or about the present discussion: I don't see how would be correct
picking the second 'f'; ambiguity seems also wrong. My reasoning is
that, according to the current C++ standard, we have a constructor from
a pair of doubles, each one *with a default*: the first f, by itself
certainly works. Then, we add a *non-standard* constructor, from
__complex__ double, and... boomer! it gets *preferred*!?! Please explain
in better detail.
Thanks in advance,
Paolo.