task's final_suspend should move the resultSection: 33.13.6.5 [task.promise] Status: New Submitter: Dietmar Kühl Opened: 2026-02-21 Last modified: 2026-02-22
Priority: Not Prioritized
View other active issues in [task.promise].
View all other issues in [task.promise].
View all issues with New status.
Discussion:
In 33.13.6.5 [task.promise] p6.3 the *result is passed to
set_value without std::moveing:
set_value(std::move(RCVR(*this)), *result).
Once set_value is called the operation state object where
result is stored just gets destroyed. The
second argument to set_value should be
std::move(*result).
Proposed resolution:
This wording is relative to N5032.
Change 33.13.6.5 [task.promise] p6.3 to std::move the
*result:
auto final_suspend() noexcept;-6- Returns: An awaitable object of unspecified type (7.6.2.4 [expr.await]) whose member functions arrange for the completion of the asynchronous operation associated with
STATE(*this)by invoking:-6.1- --
set_error(std::move(RCVR(*this)), std::move(e))iferrors.index()is greater than zero andeis the value held byerrors, otherwise-6.2- --
set_value(std::move(RCVR(*this)))ifis_void<T>istrue, and otherwise-6.3- --
set_value(std::move(RCVR(*this)), std::move(*result)).