[Bug c++/97438] [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void()

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jan 3 09:28:51 GMT 2021


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

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

https://gcc.gnu.org/g:4bca11333c274ab5d06677ed952afa097c7d3c78

commit r10-9197-g4bca11333c274ab5d06677ed952afa097c7d3c78
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sat Oct 17 11:21:11 2020 +0100

    coroutines: Emit error for invalid promise return types [PR97438].

    At one stage, use cases were proposed for allowing the promise
    type to contain both return_value and return_void.  That was
    not accepted into C++20, so we should reject it as per the PR.

    gcc/cp/ChangeLog:

            PR c++/97438
            * coroutines.cc (struct coroutine_info): Add a field to
            record that we emitted a promise type error.
            (coro_promise_type_found_p): Check for the case that the
            promise type contains both return_void and return_value.
            Emit an error if so, with information about the wrong
            type methods.

    gcc/testsuite/ChangeLog:

            PR c++/97438
            * g++.dg/coroutines/pr97438.C: New test.

    (cherry picked from commit b003c4b14b3f889e6707db68d2c6545eda7a203b)


More information about the Gcc-bugs mailing list