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

--- Comment #4 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:c5a90f61ace5aca821224a658c223881d5b02388

commit r10-8394-gc5a90f61ace5aca821224a658c223881d5b02388
Author: Iain Sandoe <i...@sandoe.co.uk>
Date:   Tue Jun 30 08:18:34 2020 +0100

    coroutines: Handle awaiters that are sub-objects [PR95736]

    Move deciding on initializers for awaitables to the build of the
    co_await, this allows us to analyse cases that do not need
    a temporary at that point.

    As the PR shows, the late analysis meant that we  were not
    checking properly for the case that an awaiter is a sub-object
    of an existing variable outside the current function scope (and
    therefore does not need to be duplicated in the frame).

    gcc/cp/ChangeLog:

            PR c++/95736
            * coroutines.cc (get_awaitable_var): New helper.
            (build_co_await): Check more carefully before
            copying an awaitable.
            (expand_one_await_expression): No initializer
            is required when the awaitable is not a temp.
            (register_awaits): Remove handling that is now
            completed when the await expression is built.

    gcc/testsuite/ChangeLog:

            PR c++/95736
            * g++.dg/coroutines/pr95736.C: New test.

    (cherry picked from commit daaed0199ee57013ae011421a7e90b7bdd295373)

Reply via email to