Title
task's final_suspend should move the result
Status
ready
Section
[task.promise]
Submitter
Dietmar Kühl

Created on 2026-02-21.00:00:00 last changed 1 week ago

Messages

Date: 2026-02-27.16:05:19

Proposed resolution:

This wording is relative to N5032.

  1. Change [task.promise] p6.3 to std::move the *result:

    auto final_suspend() noexcept;
    

    -6- Returns: An awaitable object of unspecified type ([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)) if errors.index() is greater than zero and e is the value held by errors, otherwise

    -6.2- -- set_value(std::move(RCVR(*this))) if is_void<T> is true, and otherwise

    -6.3- -- set_value(std::move(RCVR(*this)), std::move(*result)).

Date: 2026-02-15.00:00:00

[ 2026-02-27; Reflector poll. ]

Set status to Tentatively Ready after 6 votes in favour during reflector poll.

Date: 2026-02-21.00:00:00

In [task.promise] p6.3 the `*result` is passed to `set_value` without `std::move`ing: 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).

History
Date User Action Args
2026-02-27 16:05:19adminsetmessages: + msg15984
2026-02-27 16:05:19adminsetstatus: new -> ready
2026-02-22 08:31:55adminsetmessages: + msg15967
2026-02-21 00:00:00admincreate