844. complex pow return type is ambiguous

Section: 29.4.10 [cmplx.over] Status: CD1 Submitter: Howard Hinnant Opened: 2008-06-03 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [cmplx.over].

View all issues with CD1 status.

Discussion:

The current working draft is in an inconsistent state.

29.4.8 [complex.transcendentals] says that:

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

29.4.10 [cmplx.over] says that:

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

[ 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.

Proposed resolution:

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

template<class T> complex<T> pow(const complex<T>& x, int y);