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

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

https://gcc.gnu.org/g:7b4cb031cf7de0ac350197e4ae869df9fe1d08a1

commit r14-11718-g7b4cb031cf7de0ac350197e4ae869df9fe1d08a1
Author: Arsen ArsenoviÄ <ar...@aarsen.me>
Date:   Thu Jul 25 01:00:02 2024 +0200

    c++: diagnose usage of co_await and co_yield in default args [PR115906]

    This is a partial fix for PR115906.  Per [expr.await] 2s3, "An
    await-expression shall not appear in a default argument
    ([dcl.fct.default])".  This patch introduces the diagnostic in that
    case, and in the case of a co_yield (as co_yield is defined in terms of
    co_await, so prerequisites of co_await hold).

    PR c++/115906 - [coroutines] missing diagnostic and ICE when co_await used
as default argument in function declaration

    gcc/cp/ChangeLog:

            PR c++/115906
            * parser.cc (cp_parser_unary_expression): Reject await
            expressions if use of local variables is currently forbidden.
            (cp_parser_yield_expression): Reject yield expressions if use of
            local variables is currently forbidden.

    gcc/testsuite/ChangeLog:

            PR c++/115906
            * g++.dg/coroutines/pr115906-yield.C: New test.
            * g++.dg/coroutines/pr115906.C: New test.
            * g++.dg/coroutines/co-await-syntax-02-outside-fn.C: Don't rely
            on default arguments.
            * g++.dg/coroutines/co-yield-syntax-01-outside-fn.C: Ditto.

    (cherry picked from commit 0c382da0943dc7d14455ba2ada2f620a25bd1366)

Reply via email to