From 8a920365ffba8830ceb5c3fc48de9928b668b85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Sun, 31 Aug 2025 23:34:57 +0100 Subject: [PATCH 1/3] =?UTF-8?q?New=20issue=20from=20Dietmar=20K=C3=BChl:?= =?UTF-8?q?=20co=5Fawait=20change=5Fcoroutine=5Fscheduler(s)=20requires=20?= =?UTF-8?q?assignable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xml/issue4337.xml | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 xml/issue4337.xml diff --git a/xml/issue4337.xml b/xml/issue4337.xml new file mode 100644 index 0000000000..16bfe36020 --- /dev/null +++ b/xml/issue4337.xml @@ -0,0 +1,48 @@ + + + + +<code>co_await change_coroutine_scheduler(s)</code> requires assignable +
+Dietmar Kühl +31 Aug 2025 +99 + + +

+The specification of change_coroutine_scheduler(sched) uses +std::exchange to put the scheduler into place (in [task.promise] paragraph +11). The problem is that std::exchange(x, v) expects +x to be assignable from v but there is +no requirement for scheduler to be assignable. +

+
+ + +

+Change the wording in [task.promise] paragraph 11 +to avoid the use of std::exchange and transfer the using +construction: +

+
+template<class Sch>
+  auto await_transform(change_coroutine_scheduler<Sch> sch) noexcept;
+
+

+-11- Effects: Equivalent to: +

+
+return await_transform(just(exchange(SCHED(*this), scheduler_type(sch.scheduler))), *this);
+auto* s{address_of(SCHED(*this))};
+auto rc{std::move(*s)};
+s->~scheduler_type();
+new(s) scheduler_type(std::move(sch));
+return std::move(rc);
+
+
+
+

+
+ +
From c26583e08c3499b84d2515e83efeed4b7e307d69 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 1 Sep 2025 12:50:15 +0100 Subject: [PATCH 2/3] Update xml/issue4337.xml --- xml/issue4337.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xml/issue4337.xml b/xml/issue4337.xml index 16bfe36020..6a1d768fed 100644 --- a/xml/issue4337.xml +++ b/xml/issue4337.xml @@ -11,9 +11,9 @@

The specification of change_coroutine_scheduler(sched) uses -std::exchange to put the scheduler into place (in [task.promise] paragraph -11). The problem is that std::exchange(x, v) expects +std::exchange to put the scheduler into place +(in paragraph 11). +The problem is that std::exchange(x, v) expects x to be assignable from v but there is no requirement for scheduler to be assignable.

From 23250aa2f1d8cb26810b6ad8c2ec84ff55c1dd0c Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 1 Sep 2025 12:50:24 +0100 Subject: [PATCH 3/3] Update xml/issue4337.xml --- xml/issue4337.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml/issue4337.xml b/xml/issue4337.xml index 6a1d768fed..d9c709788a 100644 --- a/xml/issue4337.xml +++ b/xml/issue4337.xml @@ -21,7 +21,7 @@ no requirement for scheduler to be assignable.

-Change the wording in [task.promise] paragraph 11 +Change the wording in paragraph 11 to avoid the use of std::exchange and transfer the using construction: