coroutines: co_returns are statements, not expressions.

Message ID 04B828AA-BD2B-437E-AF79-4FC08E94E586@sandoe.co.uk
State New
Headers show
Series
  • coroutines: co_returns are statements, not expressions.
Related show

Commit Message

Iain Sandoe June 1, 2020, 8:56 a.m.
Hi

This corrects an typo in the CO_RETURN_EXPR tree class.

Although it doens’t fix any PR or regression - it seems to me that it would be
sensible to apply this to 10.2 as well as master (or it’s an accident waiting to
happen).

OK for master?
10.2 (after some bake)?
thanks
Iain

gcc/cp/ChangeLog:

	* cp-tree.def (CO_RETURN_EXPR): Correct the class
	to use tcc_statement.
---
 gcc/cp/cp-tree.def | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.24.1

Comments

Nathan Sidwell June 1, 2020, 5:18 p.m. | #1
On 6/1/20 4:56 AM, Iain Sandoe wrote:
> Hi

> 

> This corrects an typo in the CO_RETURN_EXPR tree class.

> 

> Although it doens’t fix any PR or regression - it seems to me that it would be

> sensible to apply this to 10.2 as well as master (or it’s an accident waiting to

> happen).

> 

> OK for master?

> 10.2 (after some bake)?

> thanks

> Iain

> 

> gcc/cp/ChangeLog:

> 

> 	* cp-tree.def (CO_RETURN_EXPR): Correct the class

> 	to use tcc_statement.


ok

> ---

>   gcc/cp/cp-tree.def | 4 ++--

>   1 file changed, 2 insertions(+), 2 deletions(-)

> 

> diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def

> index 1454802bf68..99851eb780f 100644

> --- a/gcc/cp/cp-tree.def

> +++ b/gcc/cp/cp-tree.def

> @@ -594,9 +594,9 @@ DEFTREECODE (CO_YIELD_EXPR, "co_yield", tcc_expression, 2)

>   /* The co_return expression is used to support coroutines.

>   

>      Op0 is the original expr, can be void (for use in diagnostics)

> -   Op2 is the promise return_xxxx call for Op0. */

> +   Op1 is the promise return_xxxx call for for the expression given. */

>   

> -DEFTREECODE (CO_RETURN_EXPR, "co_return", tcc_expression, 2)

> +DEFTREECODE (CO_RETURN_EXPR, "co_return", tcc_statement, 2)

>   

>   /*

>   Local variables:

> 



-- 
Nathan Sidwell

Patch

diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def
index 1454802bf68..99851eb780f 100644
--- a/gcc/cp/cp-tree.def
+++ b/gcc/cp/cp-tree.def
@@ -594,9 +594,9 @@  DEFTREECODE (CO_YIELD_EXPR, "co_yield", tcc_expression, 2)
 /* The co_return expression is used to support coroutines.
 
    Op0 is the original expr, can be void (for use in diagnostics)
-   Op2 is the promise return_xxxx call for Op0. */
+   Op1 is the promise return_xxxx call for for the expression given. */
 
-DEFTREECODE (CO_RETURN_EXPR, "co_return", tcc_expression, 2)
+DEFTREECODE (CO_RETURN_EXPR, "co_return", tcc_statement, 2)
 
 /*
 Local variables: