forked from lwg/issues
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue from Dietmar Kühl: co_await change_coroutine_scheduler(s) r… #471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <?xml version='1.0' encoding='utf-8' standalone='no'?> | ||
| <!DOCTYPE issue SYSTEM "lwg-issue.dtd"> | ||
|
|
||
| <issue num="4337" status="New"> | ||
| <title><code>co_await change_coroutine_scheduler(s)</code> requires assignable</title> | ||
| <section><sref ref="[task.promise]"/></section> | ||
| <submitter>Dietmar Kühl</submitter> | ||
| <date>31 Aug 2025</date> | ||
| <priority>99</priority> | ||
|
|
||
| <discussion> | ||
| <p> | ||
| The specification of <code>change_coroutine_scheduler(sched)</code> uses | ||
| <code>std::exchange</code> to put the scheduler into place (in <a | ||
| href="https://wg21.link/task.promise#11">[task.promise] paragraph | ||
| 11</a>). The problem is that <code>std::exchange(x, v)</code> expects | ||
| <code>x</code> to be assignable from <code>v</code> but there is | ||
| no requirement for scheduler to be assignable. | ||
| </p> | ||
| </discussion> | ||
|
|
||
| <resolution> | ||
| <p> | ||
| Change the wording in <a href="https://wg21.link/task.promise#11">[task.promise] paragraph 11</a> | ||
jwakely marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| to avoid the use of <code>std::exchange</code> and transfer the using | ||
| construction: | ||
| <blockquote> | ||
| <pre> | ||
| template<class Sch> | ||
| auto await_transform(change_coroutine_scheduler<Sch> sch) noexcept; | ||
| </pre> | ||
| <p> | ||
| -11- <i>Effects</i>: Equivalent to: | ||
| </p> | ||
| <pre> | ||
| <del>return await_transform(just(exchange(SCHED(*this), scheduler_type(sch.scheduler))), *this);</del><ins> | ||
| auto* s{address_of(<i>SCHED</i>(*this))}; | ||
| auto rc{std::move(*s)}; | ||
| s->~scheduler_type(); | ||
| new(s) scheduler_type(std::move(sch)); | ||
| return std::move(rc); | ||
| </ins> | ||
| </pre> | ||
| </blockquote> | ||
| </p> | ||
| </resolution> | ||
|
|
||
| </issue> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.