[Bug c++/125210] [14/15/16/17 Regression] [coroutines] Change in coroutine frame destruction behavior on exception since 14.3

bootmgr at 163 dot com gcc-bugzilla@gcc.gnu.org
Sat Aug 15 09:39:48 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125210

--- Comment #4 from bootmgr at 163 dot com <bootmgr at 163 dot com> ---
> It's not clear what the correct
> behavior is.

This exact wording question is tracked as CWG2934
(https://cplusplus.github.io/CWG/issues/2934.html).

CWG2934 notes that existing implementations destroy the promise object,
followed by the parameter copies, and then deallocate the coroutine state when 
unhandled_exception()  exits via an exception. This is the expected behavior
based on  [dcl.fct.def.coroutine]/5 .

The GCC 14.2 behavior is the intended behavior. The GCC 14.3 and later
behavior, where the promise destructor is not called and the coroutine state is
leaked, is incorrect.


More information about the Gcc-bugs mailing list