Hi Bin,

bin.cheng <bin.ch...@linux.alibaba.com> wrote:

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.  This
fixes false warning message for case like the added, or various cases in
cppcoro.

gcc/cp
2020-01-20  Bin Cheng  <bin.li...@linux.alibaba.com>

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

gcc/testsuite
2020-01-20  Bin Cheng  <bin.li...@linux.alibaba.com>

       * g++.dg/coroutines/co-return-warning-1.C: New 
test.<0001-Fix-false-warning-messages-about-missing-return-in-c.patch>


@@ -2870,6 +2874,9 @@ morph_fn_to_coro (tree orig, tree *resumer, tree *destroyer)
   if (!coro_function_valid_p (orig))
     return false;

+  /* Remember that ramp function does return.  */
“The ramp function does return a value."
+  current_function_returns_value = 1;
+

other than the comment, this LGTM - but I think that now it’s applied, you will have to wait for a C++ maintainer to approve.

thanks
Iain

Reply via email to