Skip to content

Commit 5bcc7bb

Browse files
committed
New issue from Giuseppe D'Angelo: "Missing Returns: element in optional<T&>::emplace"
1 parent 99839bb commit 5bcc7bb

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

xml/issue4300.xml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version='1.0' encoding='utf-8' standalone='no'?>
2+
<!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+
<issue num="4300" status="New">
5+
<title>Missing <i>Returns:</i> element in <tt>optional&lt;T&amp;&gt;::emplace</tt></title>
6+
<section><sref ref="[optional.ref.assign]"/></section>
7+
<submitter>Giuseppe D'Angelo</submitter>
8+
<date>15 Jul 2025</date>
9+
<priority>99</priority>
10+
11+
<discussion>
12+
<p>
13+
The specification for <tt>optional&lt;T&amp;&gt;::emplace</tt> in <sref ref="[optional.ref.assign]"/>
14+
is not specifying the returned value via a <i>Returns</i>: element; however the
15+
function does indeed return something (a <tt>T&amp;</tt>). Such a <i>Returns</i>: element is there
16+
for the primary template's `emplace` (cf. <sref ref="[optional.assign]"/>).
17+
</p>
18+
</discussion>
19+
20+
<resolution>
21+
<p>
22+
This wording is relative to this
23+
<a href="https://github.com/cplusplus/draft/actions/runs/16433597877/artifacts/3583518547">CD preview draft</a>.
24+
</p>
25+
26+
<ol>
27+
28+
<li><p>Modify <sref ref="[optional.ref.assign]"/> as indicated:</p>
29+
30+
<blockquote>
31+
<pre>
32+
template&lt;class U&gt;
33+
constexpr T&amp; emplace(U&amp;&amp; u) noexcept(is_nothrow_constructible_v&lt;T&amp;, U&gt;);
34+
</pre>
35+
<blockquote>
36+
<p>
37+
-4- <i>Constraints</i>: [&hellip;]
38+
<p/>
39+
-5- <i>Effects</i>: Equivalent to: <tt><i>convert-ref-init-val</i>(std::forward&lt;U&gt;(u))</tt>.
40+
<p/>
41+
<ins>-?- <i>Returns</i>: <tt>*<i>val</i></tt>.</ins>
42+
</p>
43+
</blockquote>
44+
</blockquote>
45+
</li>
46+
47+
</ol>
48+
</resolution>
49+
50+
</issue>

0 commit comments

Comments
 (0)