Title
task should move its result
Status
new
Section
[task.promise]
Submitter
Robert A.H. Leahy

Created on 2025-11-05.00:00:00 last changed 7 days ago

Messages

Date: 2025-12-05.16:52:33

Proposed resolution:

This wording is relative to N5014.

  1. Modify [task.promise], as indicated:

    auto final_suspend() noexcept;
    

    -7- 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:

    • (7.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
    • (7.2) — set_value(std::move(RCVR(*this))) if is_void<T> is `true`, and otherwise
    • (7.3) — set_value(std::move(RCVR(*this)), *std::move(result)).
Date: 2025-12-15.00:00:00

[ 2025-12-04; Reflector poll. ]

Set priority to 2 after reflector poll.

Date: 2025-11-15.00:00:00

[ 2025-11-07; This would be resolved by LWG 4339. ]

Date: 2025-11-05.00:00:00

In [task.promise] there's the following bullet (7.3):

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

This has the effect of sending the result as an lvalue whereas an rvalue is almost certainly what's intended, see the bullet (7.1) above:

set_error(std::move(RCVR(*this)), std::move(e)) […]

Resolution would be to change the bullet (7.3) to:

set_value(std::move(RCVR(*this)), *std::move(result)).
History
Date User Action Args
2025-12-05 16:52:33adminsetmessages: + msg15782
2025-11-08 02:29:11adminsetmessages: + msg15606
2025-11-07 18:30:15adminsetmessages: + msg15591
2025-11-05 00:00:00admincreate