[PATCH] coroutines: Handle initial awaiters with non-void returns [PR 100127].

Jason Merrill jason@redhat.com
Tue Nov 23 19:48:12 GMT 2021


On 11/19/21 12:40, Iain Sandoe wrote:
>> On 18 Nov 2021, at 23:42, Iain Sandoe <iain@sandoe.co.uk> wrote:
>>> On 18 Nov 2021, at 22:13, Jason Merrill via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>>>
>>> On 11/5/21 11:46, Iain Sandoe wrote:
>>>> The way in which a C++20 coroutine is specified discards any value
> 
>>>> 	  tree aw_r = TREE_VEC_ELT (vec, 2);
>>>> +	  if (!VOID_TYPE_P (TREE_TYPE (aw_r)))
>>>> +	    aw_r = build1 (CONVERT_EXPR, void_type_node, aw_r);
>>>
>>> Is there a reason not to use convert_to_void?
>>
>> no, just me still learning APIs… I’ll do a revised and check it.
> 
> So I’m testing this replacement:
> 
> 	  aw_r = convert_to_void (aw_r, ICV_CAST, tf_warning_or_error);

Why ICV_CAST?  I'd think ICV_STATEMENT, so that we get [[nodiscard]] 
warnings.

OK with that change.

Jason



More information about the Gcc-patches mailing list