http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56862
Bug #: 56862
Summary: std::complex constructor ambiguous overload
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: libstdc++
AssignedTo: [email protected]
ReportedBy: [email protected]
#include <complex>
struct number {
number() {}
operator std::complex<double>() const { return 0; }
operator int(); //OK if this line is commented out
};
int main() {
number const a; std::complex<double> ca(a); //OK
number b; std::complex<double> cb(b); //error: call of overloaded
'complex(number&)' is ambiguous
std::complex<double> cc(number()); //OK
return 0;
}
/*
Ambiguous overload for all gcc versions I tried (4.5 to 4.8)
on all platforms I tried (linux amd64, mingw32, cygwin).
Not sure if the problem is in libstdc++'s <complex> or in g++.
*/