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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Iain D Sandoe
<ia...@gcc.gnu.org>:

https://gcc.gnu.org/g:6efc255f3bd347a6cd13737d8cf3540eb938f424

commit r10-8388-g6efc255f3bd347a6cd13737d8cf3540eb938f424
Author: Iain Sandoe <i...@sandoe.co.uk>
Date:   Mon Jun 29 11:22:15 2020 +0100

    coroutines: Handle non-method promise expressions [PR95519]

    The PR  points out that the standard does not restrict promise
    expressions to methods, but the current implementation does.

    The patch factors out the building of a general promise expression,
    and then uses it in a fairly mechanical replacement of each case
    that we need such an expressions.

    This extends the handling for p.xxxxxx() expressions to cover the
    cases where the promise member is some form callable.

    Tests are added for each of the promise expressions.

    It's somewhat tortuous to find good uses for this for the
    get-return-object and get-return-object-on-allocation-failure
    cases, but they are included anyway.

            Backported from e74c76073092f4715007584edb1fe6b7a17274db and
31419a80b6bf84b1bf3bcb2489b2e660563f0dfe

    gcc/cp/ChangeLog:

            PR c++/95519
            * coroutines.cc (struct coroutine_info):Add a field
            to hold computed p.return_void expressions.
            (coro_build_promise_expression): New.
            (get_coroutine_return_void_expr): New.
            (finish_co_yield_expr): Build the promise expression
            using coro_build_promise_expression.
            (finish_co_return_stmt): Likewise.
            (build_init_or_final_await): Likewise.
            (morph_fn_to_coro): Likewise, for several cases.

    gcc/testsuite/ChangeLog:

            PR c++/95519
            * g++.dg/coroutines/torture/pr95519-00-return_void.C: New test.
            * g++.dg/coroutines/torture/pr95519-01-initial-suspend.C: New test.
            * g++.dg/coroutines/torture/pr95519-02-final_suspend.C: New test.
            * g++.dg/coroutines/torture/pr95519-03-return-value.C: New test.
            * g++.dg/coroutines/torture/pr95519-04-yield-value.C: New test.
            * g++.dg/coroutines/torture/pr95519-05-gro.C: New test.
            * g++.dg/coroutines/torture/pr95519-06-grooaf.C: New test.
            * g++.dg/coroutines/torture/pr95519-07-unhandled-exception.C: New
test.

Reply via email to