Title
Destroying the coroutine state when initial-await-resume-called is false
Status
open
Section
9.5.4 [dcl.fct.def.coroutine]
Submitter
Brian Bi

Created on 2024-07-13.00:00:00 last changed 1 week ago

Messages

Date: 2024-11-09.00:21:39

CWG 2024-11-08

It is unclear what the intended outcome is.

Date: 2024-07-13.00:00:00

(From submission #575.)

According to 9.5.4 [dcl.fct.def.coroutine] paragraph 11:

The coroutine state is destroyed when control flows off the end of the coroutine or the destroy member function (17.12.4.6 [coroutine.handle.resumption]) of a coroutine handle (17.12.4 [coroutine.handle]) that refers to the coroutine is invoked.

Considering the as-if code in 9.5.4 [dcl.fct.def.coroutine] paragraph 5, if an exception occurs at any point before initial-await-resume-called becomes true, then there is no requirement to destroy the coroutine state, nor is the coroutine ever suspended. Consequently, the coroutine state is necessarily leaked. It is unclear whether that is intentional.

History
Date User Action Args
2024-11-09 00:21:39adminsetmessages: + msg7887
2024-07-13 00:00:00admincreate