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

--- Comment #21 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <ia...@gcc.gnu.org>:

https://gcc.gnu.org/g:e06555a40c051d5062405b02f93b89b01a397f97

commit r16-773-ge06555a40c051d5062405b02f93b89b01a397f97
Author: Iain Sandoe <i...@sandoe.co.uk>
Date:   Mon May 12 19:47:42 2025 +0100

    c++, coroutines: Address CWG2563 return value init [PR119916].

    This addresses the clarification that, when the get_return_object is of a
    different type from the ramp return, any necessary conversions should be
    performed on the return expression (so that they typically occur after the
    function body has started execution).

            PR c++/119916

    gcc/cp/ChangeLog:

            * coroutines.cc
            (cp_coroutine_transform::wrap_original_function_body): Do not
            initialise initial_await_resume_called here...
            (cp_coroutine_transform::build_ramp_function): ... but here.
            When the coroutine is not void, initialize a GRO object from
            promise.get_return_object().  Use this as the argument to the
            return expression.  Use a regular cleanup for the GRO, since
            it is ramp-local.

    gcc/testsuite/ChangeLog:

            *
g++.dg/coroutines/torture/special-termination-00-sync-completion.C:
            Amend for CWG2563 expected behaviour.
            * g++.dg/coroutines/torture/special-termination-01-self-destruct.C:
            Likewise.
            * g++.dg/coroutines/torture/pr119916.C: New test.

    Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>

Reply via email to