https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106997
--- Comment #2 from Wilhelm M <klaus.doldinger64 at googlemail dot com> --- I would consider this a missed optimization rather than a bug, because the standard says, that an implementation can avoid heap allocation if: - the lifetime of the coroutine is strictly within the lifetime of the caller - the size of coroutine state can be determined at compile time The case I tested falls within the above statement.