You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
P1787 changed the wording of [dcl.fct.def.coroutine/11] regarding the destruction of variables with automatic storage duration from:
In the latter case objects with automatic storage duration that are in scope at the suspend point are destroyed in the reverse order of the construction.
to:
In the latter case, control in the coroutine is considered to be transferred out of the function ([stmt.dcl/2]).
Upon each transfer of control (including sequential execution of statements) within a function from point P to point Q, all block variables with automatic storage duration that are active at P and not at Q are destroyed in the reverse order of their construction.
This only applies to transferring control "within a function", which does not seem to cover the case for coroutines. If so, there currently appears to be no wording specifying how local variables are destroyed when a coroutine is exited.
Suggested resolution:
Clarify the wording of [stmt.dcl/2] to cover transfers of control out of a function.
The text was updated successfully, but these errors were encountered:
There's also the thing that "within a function" doesn't mean that both the source and target of a control transfer are within a function, but the control transfer operation is within a function.
Jens, we could clarify this with Upon each transfer of control (including sequential execution of statements) within <ins>or out of</ins> a function.
jensmaurer
changed the title
[stmt.dcl] p2 Destruction of variables with automatic storage duration on coroutine exit
CWG2976 [stmt.dcl] p2 Destruction of variables with automatic storage duration on coroutine exit
Dec 27, 2024
Full name of submitter: Artem Koton
Reference (section label): [stmt.dcl] p2
Issue description:
P1787 changed the wording of [dcl.fct.def.coroutine/11] regarding the destruction of variables with automatic storage duration from:
to:
According to [stmt.dcl/2]:
This only applies to transferring control "within a function", which does not seem to cover the case for coroutines. If so, there currently appears to be no wording specifying how local variables are destroyed when a coroutine is exited.
Suggested resolution:
Clarify the wording of [stmt.dcl/2] to cover transfers of control out of a function.
The text was updated successfully, but these errors were encountered: