This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.
4191. P1467 changed the return type ofpow(complex<float>, int)
Section: 29.4.10 [cmplx.over] Status: WP Submitter: Tim Song Opened: 2025-01-10 Last modified: 2025-02-16
Priority: Not Prioritized
View all other issues in [cmplx.over].
View all issues with WP status.
Discussion:
Before C++20, 29.4.10 [cmplx.over] says that this produces a complex<double>
. This was confirmed by LWG 844(i) and consistent with C99.
complex<common_type_t<float, int>>
, which is complex<float>
. This is a breaking change that does not appear to have been intentional.
[2025-02-07; Reflector poll]
Set status to Tentatively Ready after eight votes in favour during reflector poll.
[Hagenberg 2025-02-16; Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N5001.
Modify 29.4.10 [cmplx.over] as indicated:
-3- Function template
pow
has additional constexpr overloads sufficient to ensure, for a call with one argument of typecomplex<T1>
and the other argument of typeT2
orcomplex<T2>
, both arguments are effectively cast tocomplex<common_type_t<T1, T3 T2>>
, whereT3
isdouble
ifT2
is an integer type andT2
otherwise. Ifcommon_type_t<T1, T3 T2>
is not well-formed, then the program is ill-formed.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4