File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed
Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ <?xml version =' 1.0' encoding =' utf-8' standalone =' no' ?>
2+ <!DOCTYPE issue SYSTEM "lwg-issue.dtd">
3+
4+ <issue num =" 4439" status =" New" >
5+ <title ><tt >std::optional< T&> ::swap</tt > possibly selects ADL-found `swap`</title >
6+ <section ><sref ref =" [optional.ref.swap]" /></section >
7+ <submitter >Jiang An</submitter >
8+ <date >31 Oct 2025</date >
9+ <priority >99</priority >
10+
11+ <discussion >
12+ <p >
13+ Currently, <sref ref =" [optional.ref.swap]" /> p1 specifies an "unqualified" `swap` call, which
14+ possibly selects an ADL-found swap function due to <sref ref =" [contents]" /> and
15+ <sref ref =" [swappable.requirements]" />.
16+ <p />
17+ It's unlike to be intentional to call ADL-found `swap` on pointers (given `ranges::swap`
18+ doesn't), and the unconditional `noexcept` also suggests that user-provided `swap` functions
19+ shouldn't interfere with <tt >optional< T&> ::swap</tt >.
20+ </p >
21+ </discussion >
22+
23+ <resolution >
24+ <p >
25+ This wording is relative to <paper num =" N5014" />.
26+ </p >
27+
28+ <ol >
29+
30+ <li ><p >Modify <sref ref =" [optional.ref.swap]" /> as indicated:</p >
31+
32+ <blockquote >
33+ <pre >
34+ constexpr void swap(optional& rhs) noexcept;
35+ </pre >
36+ <blockquote >
37+ <p >
38+ -1- <i >Effects</i >: Equivalent to: <tt ><ins >std::</ins >swap(<i >val</i >, rhs.<i >val</i >)</tt >.
39+ </p >
40+ </blockquote >
41+ </blockquote >
42+ </li >
43+ </ol >
44+
45+ </resolution >
46+
47+ </issue >
You can’t perform that action at this time.
0 commit comments