https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86943

--- Comment #12 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Wed Jan 30 02:43:04 2019
New Revision: 268377

URL: https://gcc.gnu.org/viewcvs?rev=268377&root=gcc&view=rev
Log:
        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.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv13.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/lambda.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/typeck.c

Reply via email to