File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed
Expand file tree Collapse file tree 1 file changed +48
-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 =" 4337" status =" New" >
5+ <title ><code >co_await change_coroutine_scheduler(s)</code > requires assignable</title >
6+ <section ><sref ref =" [task.promise]" /></section >
7+ <submitter >Dietmar Kühl</submitter >
8+ <date >31 Aug 2025</date >
9+ <priority >99</priority >
10+
11+ <discussion >
12+ <p >
13+ The specification of <code >change_coroutine_scheduler(sched)</code > uses
14+ <code >std::exchange</code > to put the scheduler into place (in <a
15+ href=" https://wg21.link/task.promise#11" >[task.promise] paragraph
16+ 11</a >). The problem is that <code >std::exchange(x, v)</code > expects
17+ <code >x</code > to be assignable from <code >v</code > but there is
18+ no requirement for scheduler to be assignable.
19+ </p >
20+ </discussion >
21+
22+ <resolution >
23+ <p >
24+ Change the wording in <a href =" https://wg21.link/task.promise#11" >[task.promise] paragraph 11</a >
25+ to avoid the use of <code >std::exchange</code > and transfer the using
26+ construction:
27+ <blockquote >
28+ <pre >
29+ template< class Sch>
30+ auto await_transform(change_coroutine_scheduler< Sch> sch) noexcept;
31+ </pre >
32+ <p >
33+ -11- <i >Effects</i >: Equivalent to:
34+ </p >
35+ <pre >
36+ <del >return await_transform(just(exchange(SCHED(*this), scheduler_type(sch.scheduler))), *this);</del ><ins >
37+ auto* s{address_of(<i >SCHED</i >(*this))};
38+ auto rc{std::move(*s)};
39+ s->~scheduler_type();
40+ new(s) scheduler_type(std::move(sch));
41+ return std::move(rc);
42+ </ins >
43+ </pre >
44+ </blockquote >
45+ </p >
46+ </resolution >
47+
48+ </issue >
You can’t perform that action at this time.
0 commit comments