PR c++/86943 - wrong code converting lambda to function pointer.
authorJason Merrill <jason@redhat.com>
Wed, 30 Jan 2019 02:43:04 +0000 (21:43 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 30 Jan 2019 02:43:04 +0000 (21:43 -0500)
commit538a530848375deb14495fae5a5ccf5ae5daedba
tree2014ffc7cf9d736a2f0e7a17bddbaa3c9087d660
parentdca2770bc073353e621e426d4803b8ea16382b5a
PR c++/86943 - wrong code converting lambda to function pointer.

In this PR, instantiating the static thunk returned from the generic lambda
conversion function template was using normal overload resolution, which
meant calling an extra constructor when forwarding its argument.  Fixed by
special-casing thunk calls significantly more.

* lambda.c (maybe_add_lambda_conv_op): Use a template-id in the
call.  Only forward parms for decltype.
* pt.c (tsubst_copy_and_build) [CALL_EXPR]: Handle CALL_FROM_THUNK_P
specially.
* typeck.c (check_return_expr): Don't mess with a thunk call.

From-SVN: r268377
gcc/cp/ChangeLog
gcc/cp/lambda.c
gcc/cp/pt.c
gcc/cp/typeck.c
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv13.C [new file with mode: 0644]