Skip to content

Commit 53249bb

Browse files
committed
New issue from Jiang An: "Move assignment operator of std::expected<cv void, E> should not be conditionally deleted"
1 parent c5e2c16 commit 53249bb

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

xml/issue4025.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4025" status="New">
5+
<title>Move assignment operator of <tt>std::expected&lt;<i>cv</i> void, E&gt;</tt> should not be conditionally deleted</title>
6+
<section><sref ref="[expected.void.assign]"/></section>
7+
<submitter>Jiang An</submitter>
8+
<date>16 Dec 2023</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
It seems intended that copy functions of <tt>std::optional</tt>, <tt>std::variant</tt>, and <tt>std::expected</tt>
14+
are conditionally deleted, while move functions are constrained. However, the move assignment operator of
15+
<tt>std::expected&lt;<i>cv</i> void, E&gt;</tt> is currently conditionally deleted, which is inconsistent.
16+
</p>
17+
</discussion>
18+
19+
<resolution>
20+
<p>
21+
This wording is relative to <paper num="N4971"/>.
22+
</p>
23+
24+
<ol>
25+
26+
<li><p>Modify <sref ref="[expected.void.assign]"/> as indicated:</p>
27+
28+
<blockquote>
29+
<pre>
30+
constexpr expected&amp; operator=(expected&amp;&amp; rhs) noexcept(<i>see below</i>);
31+
</pre>
32+
<blockquote>
33+
<p>
34+
<ins>-?- <i>Constraints</i>: <tt>is_move_constructible_v&lt;E&gt;</tt> is <tt>true</tt> and
35+
<tt>is_move_assignable_v&lt;E&gt;</tt> is <tt>true</tt>.</ins>
36+
<p/>
37+
[&hellip;]
38+
<p/>
39+
-6- <i>Remarks</i>: The exception specification is equivalent to <tt>is_nothrow_move_constructible_v&lt;E&gt; &amp;&amp;
40+
is_nothrow_move_assignable_v&lt;E&gt;</tt>.
41+
<p/>
42+
<del>-7- This operator is defined as deleted unless <tt>is_move_constructible_v&lt;E&gt;</tt> is <tt>true</tt>
43+
and <tt>is_move_assignable_v&lt;E&gt;</tt> is <tt>true</tt>.</del>
44+
</p>
45+
</blockquote>
46+
</blockquote>
47+
</li>
48+
49+
</ol>
50+
51+
52+
</resolution>
53+
54+
</issue>

0 commit comments

Comments
 (0)