From 697a7a575de01835b3941e6b6d25b940033301d5 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 28 Sep 2017 15:39:32 -0400 Subject: [PATCH] Small lambda fixes. * call.c (build_special_member_call): Use the return value of mark_lvalue_use. * decl.c (compute_array_index_type): Likewise. * parser.c (cp_parser_oacc_wait_list): Likewise. * lambda.c (is_normal_capture_proxy): Handle *this capture. (add_capture): Clarify internal_error message. From-SVN: r253264 --- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/call.c | 2 +- gcc/cp/decl.c | 2 +- gcc/cp/lambda.c | 5 ++++- gcc/cp/parser.c | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 58e6f25ff20..eeea726afdb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2017-09-28 Jason Merrill + + * call.c (build_special_member_call): Use the return value of + mark_lvalue_use. + * decl.c (compute_array_index_type): Likewise. + * parser.c (cp_parser_oacc_wait_list): Likewise. + * lambda.c (is_normal_capture_proxy): Handle *this capture. + (add_capture): Clarify internal_error message. + 2017-09-22 Eric Botcazou PR bootstrap/81926 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index e83cf99dc89..99a7b77efb2 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -8845,7 +8845,7 @@ build_special_member_call (tree instance, tree name, vec **args, && (flags & LOOKUP_DELEGATING_CONS)) check_self_delegation (arg); /* Avoid change of behavior on Wunused-var-2.C. */ - mark_lvalue_use (instance); + instance = mark_lvalue_use (instance); return build2 (INIT_EXPR, class_type, instance, arg); } } diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 50fa1ba402e..ce45c1140d6 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9329,7 +9329,7 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain) { tree type = TREE_TYPE (size); - mark_rvalue_use (size); + size = mark_rvalue_use (size); if (cxx_dialect < cxx11 && TREE_CODE (size) == NOP_EXPR && TREE_SIDE_EFFECTS (size)) diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index e4412569a61..695666abbe3 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -283,6 +283,8 @@ is_normal_capture_proxy (tree decl) if (val == error_mark_node) return true; + if (TREE_CODE (val) == ADDR_EXPR) + val = TREE_OPERAND (val, 0); gcc_assert (TREE_CODE (val) == COMPONENT_REF); val = TREE_OPERAND (val, 1); return DECL_NORMAL_CAPTURE_P (val); @@ -592,7 +594,8 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p, && current_class_type == LAMBDA_EXPR_CLOSURE (lambda)) { if (COMPLETE_TYPE_P (current_class_type)) - internal_error ("trying to capture %qD after closure is complete", id); + internal_error ("trying to capture %qD in instantiation of " + "generic lambda", id); finish_member_declaration (member); } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index f9b6f278afb..bb2a8774aa0 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -31712,7 +31712,7 @@ cp_parser_oacc_wait_list (cp_parser *parser, location_t clause_loc, tree list) { tree c = build_omp_clause (clause_loc, OMP_CLAUSE_WAIT); - mark_rvalue_use (targ); + targ = mark_rvalue_use (targ); OMP_CLAUSE_DECL (c) = targ; OMP_CLAUSE_CHAIN (c) = list; list = c; -- 2.30.2