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

--- Comment #2 from CVS 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:e74c76073092f4715007584edb1fe6b7a17274db

commit r11-1673-ge74c76073092f4715007584edb1fe6b7a17274db
Author: Iain Sandoe <i...@sandoe.co.uk>
Date:   Fri Jun 26 10:48:35 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.

    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