This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-11-11


2935. Destroying the coroutine state when initial-await-resume-called is false

Section: 9.5.4  [dcl.fct.def.coroutine]     Status: open     Submitter: Brian Bi     Date: 2024-07-13

(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.

CWG 2024-11-08

It is unclear what the intended outcome is.