Skip to content

Commit c83d040

Browse files
committed
Update 4406 P/R to also resolve 3424
1 parent 2697c74 commit c83d040

File tree

2 files changed

+74
-11
lines changed

2 files changed

+74
-11
lines changed

xml/issue3424.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ return bool(*this) ? std::move(**this) : static_cast&lt;<del>T</del><ins>R</ins>
8080

8181
<note>2023-02-09 Casey improves wording and expands to cover <tt>expected::value_or</tt></note>
8282
<p>Since <tt>expected</tt> was modeled on <tt>optional</tt>, it has the same issue.</p>
83+
84+
<note>2025-11-19; This would be resolved by <iref ref="4406"/>.</note>
8385
</discussion>
8486

8587
<resolution>

xml/issue4406.xml

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ return std::forward&lt;U&gt;(v);</ins>
173173
Rebase after LWG <iref ref="4015"/> which was approved in Kona.
174174
This would also resolve LWG <iref ref="4281"/>.
175175
</p>
176+
<note>2025-11-19; Jonathan provides updated wording</note>
177+
<p>
178+
Incorporate proposed resolution of <iref ref="3424"/> as well.
179+
</p>
176180

177181
</discussion>
178182

@@ -183,15 +187,35 @@ This wording is relative to <b>the working draft after <paper num="N5014"/></b>.
183187

184188
<ol>
185189

190+
<li><p>Modify <sref ref="[optional.optional.general]"/> as indicated:</p>
191+
192+
<blockquote>
193+
<pre>
194+
[&hellip;]
195+
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr <ins>remove_cv_t&lt;</ins>T<ins>&gt;</ins> value_or(U&amp;&amp;) const &amp;;
196+
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr <ins>remove_cv_t&lt;</ins>T<ins>&gt;</ins> value_or(U&amp;&amp;) &amp;&amp;;
197+
[&hellip;]
198+
</pre>
199+
</blockquote>
200+
</li>
201+
186202
<li><p>Modify <sref ref="[optional.observe]"/> as indicated:</p>
187203

188204
<blockquote>
189205
<pre>
190-
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr T value_or(U&amp;&amp; v) const &amp;;
206+
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr <ins>remove_cv_t&lt;</ins>T<ins>&gt;</ins> value_or(U&amp;&amp; v) const &amp;;
191207
</pre>
192208
<blockquote>
193209
<p>
194-
-15- <i>Mandates</i>: <code>is_copy_constructible_v&lt;T&gt; &amp;&amp; is_convertible_v&lt;U&amp;&amp;, T&gt;</code>
210+
<ins>-?- Let <code>X</code> be <code>remove_cv_t&lt;T&gt;</code>.</ins>
211+
</p>
212+
<p>
213+
-15- <i>Mandates</i>:
214+
<code>
215+
<del>is_copy_constructible_v&lt;T&gt;</del> <ins>is_convertible_v&lt;const T&amp;, X&gt;</ins>
216+
&amp;&amp;
217+
is_convertible_v&lt;U<del>&amp;&amp;</del>, <del>T</del> <ins>X</ins>&gt;
218+
</code>
195219
is `true`.
196220
<p/>
197221
-16- <i>Effects</i>: Equivalent to:
@@ -204,11 +228,19 @@ return std::forward&lt;U&gt;(v);</ins>
204228
</pre></blockquote>
205229
</blockquote>
206230
<pre>
207-
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr T value_or(U&amp;&amp; v) &amp;&amp;;
231+
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr <ins>remove_cv_t&lt;</ins>T<ins>&gt;</ins> value_or(U&amp;&amp; v) &amp;&amp;;
208232
</pre>
209233
<blockquote>
210234
<p>
211-
-17- <i>Mandates</i>: <code>is_move_constructible_v&lt;T&gt; &amp;&amp; is_convertible_v&lt;U&amp;&amp;, T&gt;</code>
235+
<ins>-?- Let <code>X</code> be <code>remove_cv_t&lt;T&gt;</code>.</ins>
236+
</p>
237+
<p>
238+
-17- <i>Mandates</i>:
239+
<code>
240+
<del>is_move_constructible_v&lt;T&gt;</del> <ins>is_convertible_v&lt;T, X&gt;</ins>
241+
&amp;&amp;
242+
is_convertible_v&lt;U<del>&amp;&amp;</del>, <del>T</del> <ins>X</ins>&gt;
243+
</code>
212244
is `true`.
213245
<p/>
214246
-18- <i>Effects</i>: Equivalent to:
@@ -247,7 +279,12 @@ template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr remove_cv_t&lt;T&gt; va
247279
<p>
248280
-8- Let <code>X</code> be <code>remove_cv_t&lt;T&gt;</code>.
249281
<p/>
250-
-9- <i>Mandates</i>: <code>is_constructible_v&lt;X, T&amp;&gt; &amp;&amp; is_convertible_v&lt;U, X&gt;</code>
282+
-9- <i>Mandates</i>:
283+
<code>
284+
<del>is_constructible_v&lt;T&gt;</del> <ins>is_convertible_v&lt;T&amp;, X&gt;</ins>
285+
&amp;&amp;
286+
is_convertible_v&lt;U, X&gt;
287+
</code>
251288
is `true`.
252289
<p/>
253290
-10- <i>Effects</i>: Equivalent to:
@@ -262,16 +299,34 @@ return std::forward&lt;U&gt;(u);</ins>
262299
</blockquote>
263300
</li>
264301

302+
<li><p>Modify <sref ref="[expected.object.general]"/> as indicated:</p>
303+
304+
<blockquote>
305+
<pre>
306+
[&hellip;]
307+
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr <ins>remove_cv_t&lt;</ins>T<ins>&gt;</ins> value_or(U&amp;&amp;) const &amp;;
308+
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr <ins>remove_cv_t&lt;</ins>T<ins>&gt;</ins> value_or(U&amp;&amp;) &amp;&amp;;
309+
[&hellip;]
310+
</pre>
311+
</blockquote>
312+
</li>
313+
265314
<li><p>Modify <sref ref="[expected.object.obs]"/> as indicated:</p>
266315

267316
<blockquote>
268317
<pre>
269-
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr T value_or(U&amp;&amp; v) const &amp;;
318+
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr <ins>remove_cv_t&lt;</ins>T<ins>&gt;</ins> value_or(U&amp;&amp; v) const &amp;;
270319
</pre>
271320
<blockquote>
272321
<p>
273-
-18- <i>Mandates</i>: <code>is_copy_constructible_v&lt;T&gt;</code> is `true` and
274-
<code>is_convertible_v&lt;U, T&gt;</code> is `true`.
322+
<ins>-?- Let <code>X</code> be <code>remove_cv_t&lt;T&gt;</code>.</ins>
323+
</p>
324+
<p>
325+
-18- <i>Mandates</i>:
326+
<del><code>is_copy_constructible_v&lt;T&gt;</code> is `true` and</del>
327+
<ins><code>is_convertible_v&lt;const T&amp;, X&gt; &amp;&amp;</code></ins>
328+
<code>is_convertible_v&lt;U, T&gt;</code>
329+
is `true`.
275330
<p/>
276331
<del>-19- <i>Returns</i>: <code>has_value() ? **this : static_cast&lt;T&gt;(std::forward&lt;U&gt;(v))</code>.</del>
277332
<p/>
@@ -284,12 +339,18 @@ return std::forward&lt;U&gt;(v);</ins>
284339
</pre></blockquote>
285340
</blockquote>
286341
<pre>
287-
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr T value_or(U&amp;&amp; v) &amp;&amp;;
342+
template&lt;class U = remove_cv_t&lt;T&gt;&gt; constexpr <ins>remove_cv_t&lt;</ins>T<ins>&gt;</ins> value_or(U&amp;&amp; v) &amp;&amp;;
288343
</pre>
289344
<blockquote>
290345
<p>
291-
-20- <i>Mandates</i>: <code>is_move_constructible_v&lt;T&gt;</code> is `true` and
292-
<code>is_convertible_v&lt;U, T&gt;</code> is `true`.
346+
<ins>-?- Let <code>X</code> be <code>remove_cv_t&lt;T&gt;</code>.</ins>
347+
</p>
348+
<p>
349+
-20- <i>Mandates</i>:
350+
<del><code>is_move_constructible_v&lt;T&gt;</code> is `true` and</del>
351+
<ins><code>is_convertible_v&lt;T, X&gt; &amp;&amp;</code></ins>
352+
<code>is_convertible_v&lt;U, T&gt;</code>
353+
is `true`.
293354
<p/>
294355
<del>-21- <i>Returns</i>: <code>has_value() ? std::move(**this) : static_cast&lt;T&gt;(std::forward&lt;U&gt;(v))</code>.</del>
295356
<p/>

0 commit comments

Comments
 (0)