More delayed lambda capture fixes.
commitc017458ddd7934b084d39c3bd6919914619035bf
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Oct 2017 18:04:02 +0000 (10 18:04 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Oct 2017 18:04:02 +0000 (10 18:04 +0000)
treea1d29341c64d9d46baace208102db49665b10367
parent672871cefb6a271eeb500e6174cb6499df840e5b
More delayed lambda capture fixes.

* call.c (add_function_candidate): Use build_address.
(build_op_call_1): Call mark_lvalue_use early.
(build_over_call): Handle error from build_this.
* constexpr.c (cxx_bind_parameters_in_call): Use build_address.
(cxx_eval_increment_expression): Don't use rvalue().
* cvt.c (convert_to_void): Use mark_discarded_use.
* expr.c (mark_use): Handle PARM_DECL, NON_DEPENDENT_EXPR.  Fix
reference handling.  Don't copy the expression.
(mark_discarded_use): New.
* lambda.c (insert_capture_proxy): Add some sanity checking.
(maybe_add_lambda_conv_op): Set cp_unevaluated_operand.
* pt.c (register_local_specialization): Add sanity check.
* semantics.c (process_outer_var_ref): Fix check for existing proxy.
* typeck.c (cp_build_addr_expr_1): Handle error from
mark_lvalue_use.
(cp_build_modify_expr): Call mark_lvalue_use_nonread, handle error
from rvalue.

Handle generic lambda capture in dependent expressions.
* lambda.c (need_generic_capture, dependent_capture_r)
(do_dependent_capture): New.
* pt.c (processing_nonlambda_template): Use need_generic_capture.
* semantics.c (maybe_cleanup_point_expr)
(maybe_cleanup_point_expr_void, finish_goto_stmt)
(maybe_convert_cond): Call do_dependent_capture.
* typeck.c (build_static_cast): Remove dependent capture handling.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253601 138bc75d-0d04-0410-961f-82ee72b054a4
16 files changed:
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/constexpr.c
gcc/cp/cp-tree.h
gcc/cp/cvt.c
gcc/cp/decl.c
gcc/cp/expr.c
gcc/cp/lambda.c
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/cp/typeck.c
gcc/testsuite/g++.dg/cpp0x/error1.C
gcc/testsuite/g++.dg/cpp1y/lambda-generic-dep2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice5.C
gcc/testsuite/g++.dg/template/crash108.C