Skip to content

Commit 935970b

Browse files
committed
New issue from Tim Song: "P1467 changed the return type of pow(complex<float>, int)"
1 parent 40f6fef commit 935970b

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

xml/issue4191.xml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4191" status="New">
5+
<title>P1467 changed the return type of <tt>pow(complex&lt;float&gt;, int)</tt></title>
6+
<section><sref ref="[cmplx.over]"/></section>
7+
<submitter>Tim Song</submitter>
8+
<date>10 Jan 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
Before C++20,<sref ref="[cmplx.over]"/> says that this produces a <tt>complex&lt;double&gt;</tt>.
14+
This was confirmed by LWG <iref ref="844"/> and consistent with C99.
15+
<p/>
16+
<paper num="P1467"/> changed the return type to <tt>complex&lt;common_type_t&lt;float, int&gt;&gt;</tt>,
17+
which is <tt>complex&lt;float&gt;</tt>. This is a breaking change that does not appear to have been
18+
intentional.
19+
</p>
20+
</discussion>
21+
22+
<resolution>
23+
<p>
24+
This wording is relative to <paper num="N5001"/>.
25+
</p>
26+
27+
<ol>
28+
29+
<li><p>Modify <sref ref="[cmplx.over]"/> as indicated:</p>
30+
31+
<blockquote><p>
32+
-3- Function template `pow` has additional constexpr overloads sufficient to ensure, for a call with one argument of
33+
type <tt>complex&lt;T1&gt;</tt> and the other argument of type `T2` or <tt>complex&lt;T2&gt;</tt>, both arguments
34+
are effectively cast to <tt>complex&lt;common_type_t&lt;T1, <ins>T3</ins><del>T2</del>&gt;&gt;</tt><ins>, where
35+
`T3` is `double` if `T2` is an integer type and `T2` otherwise</ins>. If <tt>common_type_t&lt;T1, <ins>T3</ins><del>T2</del>&gt;</tt>
36+
is not well-formed, then the program is ill-formed.
37+
</p></blockquote>
38+
</li>
39+
</ol>
40+
41+
</resolution>
42+
43+
</issue>

0 commit comments

Comments
 (0)