[PATCH] coroutines: Handle lambda capture objects in the way as clang.

Nathan Sidwell nathan@acm.org
Wed Apr 22 13:34:54 GMT 2020


On 4/22/20 8:48 AM, Iain Sandoe wrote:
> Hi,
> 
> There is no PR for this, at present, but the implementation of
> clang and GCC's handling of lambda capture object implicit parms
> is currently different.  There is still some discussion about
> 'correct' interpretation of the standard - but in the short-term
> it is probably best to have consistent implementations - even if
> those subsequently turn out to be 'consistently wrong'.

Agreed, the std is at best ambigiuous in this area, we should aim for 
implementation agreement.

It would be good to comment as such in the code itself.

> +	    is_this_parameter (arg)
> +	    || (DECL_NAME (arg) && DECL_NAME (arg) == closure_identifier);

DECL_NAME (arg) == closure_identifier
is sufficient (it can't be NULL and == an ident :)


> +	      parm.this_ptr = false;
> +	      parm.lambda_cobj = is_this_parameter (arg)
> +				 || (DECL_NAME (arg)
> +				     && DECL_NAME (arg) == closure_identifier);

and here.

Otherwise ok

nathan


-- 
Nathan Sidwell


More information about the Gcc-patches mailing list