Title
complex pow return type is ambiguous
Status
cd1
Section
[cmplx.over]
Submitter
Howard Hinnant

Created on 2008-06-03.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Strike this pow overload in [complex.syn] and in [complex.transcendentals]:

template<class T> complex<T> pow(const complex<T>& x, int y);
Date: 2010-10-21.18:28:33

[ Sophia Antipolis: ]

Since int promotes to double, and C99 doesn't have an int-based overload for pow, the C99 result is complex<double>, see also C99 7.22, see also library issue 550.

Special note: ask P.J. Plauger.

Looks fine.

Date: 2008-06-03.00:00:00

The current working draft is in an inconsistent state.

[complex.transcendentals] says that:

pow(complex<float>(), int()) returns a complex<float>.

[cmplx.over] says that:

pow(complex<float>(), int()) returns a complex<double>.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg4025
2010-10-21 18:28:33adminsetmessages: + msg4024
2008-06-03 00:00:00admincreate