More delayed lambda capture fixes

Programming / Compilers / GCC - jason [138bc75d-0d04-0410-961f-82ee72b054a4] - 10 October 2017 14:04 EDT

- 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.

c017458 More delayed lambda capture fixes.
gcc/cp/ChangeLog | 28 +++++
gcc/cp/call.c | 13 ++-
gcc/cp/constexpr.c | 11 +-
gcc/cp/cp-tree.h | 3 +
gcc/cp/cvt.c | 18 +---
gcc/cp/decl.c | 2 +
gcc/cp/expr.c | 78 ++++++++++----
gcc/cp/lambda.c | 130 ++++++++++++++++++++++-
gcc/cp/parser.c | 2 +
gcc/cp/pt.c | 25 +----
gcc/cp/semantics.c | 16 ++-
gcc/cp/typeck.c | 15 +--
gcc/testsuite/g++.dg/cpp0x/error1.C | 11 +-
gcc/testsuite/g++.dg/cpp1y/lambda-generic-dep2.C | 18 ++++
gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice5.C | 2 +-
gcc/testsuite/g++.dg/template/crash108.C | 2 +-
16 files changed, 300 insertions(+), 74 deletions(-)

Upstream: gcc.gnu.org


  • Share