Fix false warning messages about missing return in coroutine.
authorBin Cheng <bin.cheng@linux.alibaba.com>
Tue, 21 Jan 2020 04:16:16 +0000 (12:16 +0800)
committerBin Cheng <bin.cheng@linux.alibaba.com>
Tue, 21 Jan 2020 04:16:16 +0000 (12:16 +0800)
commitb313d3c49c2387b5e212df22a5e6ecc0c4e95c0a
treef4dc220f6300557ea83337fa529da0cd118102a2
parente0a5b313c1a3edfb33a28b8d8fea92e01490ebb3
Fix false warning messages about missing return in coroutine.

The patch sets current_function_returns_value flag in templates for
all co_return/co_yield/co_await cases, as well as for ramp function.

gcc/cp/ChangeLog
    * coroutines.cc (finish_co_await_expr): Set return value flag.
    (finish_co_yield_expr, morph_fn_to_coro): Ditto.

gcc/testsuite/ChangeLog
    * g++.dg/coroutines/co-return-warning-1.C: New test.
gcc/cp/ChangeLog
gcc/cp/coroutines.cc
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/coroutines/co-return-warning-1.C [new file with mode: 0644]