PR c++/84726 - unnecessary capture of constant vars.
authorJason Merrill <jason@redhat.com>
Fri, 9 Mar 2018 21:40:55 +0000 (16:40 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 9 Mar 2018 21:40:55 +0000 (16:40 -0500)
commit1577f10a637352b4fe7fb4a4c0fd672a96c84f58
treeafa0946e5089101e7d7a41bfed0009c943fdcfe8
parent5f2440b05799cb854b8d4a7622d50d7abcfecb0f
PR c++/84726 - unnecessary capture of constant vars.

* cp-tree.h (LAMBDA_CAPTURE_EXPLICIT_P)
(LAMBDA_EXPR_CAPTURE_OPTIMIZED): New.
* expr.c (mark_use): Set LAMBDA_EXPR_CAPTURE_OPTIMIZED.
* lambda.c (is_constant_capture_proxy)
(current_lambda_expr, var_to_maybe_prune, mark_const_cap_r)
(prune_lambda_captures): New.
(finish_lambda_function): Call prune_lambda_captures.

From-SVN: r258398
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/expr.c
gcc/cp/lambda.c
gcc/testsuite/g++.dg/abi/lambda-capture1.C [new file with mode: 0644]