https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56862
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to cbcode from comment #0)
> std::complex<double> cc(number()); //OK
This is only OK because it's a function declaration, not a variable definition.
See https://en.wikipedia.org/wiki/Most_vexing_parse
If you change it to be a variable then you get the same ambiguity:
std::complex<double> cc{number()}; // ambiguous
std::complex<double> cc = number(); // ambiguous
std::complex<double> cc = std::complex<double>(number()); // ambiguous
And that's correct, there are two user-defined conversions that can be used to
construct a std::complex<double> from a number, so this is not a bug.