[C++ PATCH] Fix wrong-code with generic lambda (PR c++/86943)

Jason Merrill jason@redhat.com
Tue Nov 27 22:21:00 GMT 2018


On 11/23/18 4:15 PM, Jakub Jelinek wrote:
> Hi!
> 
> On the following testcase, the call to operator () is marked as
> CALL_FROM_THUNK_P and therefore genericization ignores all subtrees thereof.
> Unfortunately, one of the arguments is a move ctor call which is not itself
> CALL_FROM_THUNK_P and thus we need to genericize its arguments, otherwise
> we pass address of a temporary which holds a reference value instead of the
> reference itself.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> Or should CALL_FROM_THUNK_P not be set in this call (it is set in
> maybe_add_lambda_conv_op and then copied over during tsubst*).

The call with CALL_FROM_THUNK_P set should be inside the thunk whose 
address we get when converting the lambda to a function pointer (on 
return from foo).  Its arguments should just be the parms of that thunk, 
I don't know where this temporary is coming from.

Jason



More information about the Gcc-patches mailing list