From 281e6c1d8f1b4ca552d8ce2276ddecfcd6ffb15e Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 28 Sep 2017 15:39:45 -0400 Subject: PR c++/56973, DR 696 - capture constant variables only as needed. * expr.c (mark_use): Split out from mark_rvalue_use and mark_lvalue_use. Handle lambda capture of constant variables. (mark_lvalue_use_nonread): New. * semantics.c (process_outer_var_ref): Don't capture a constant variable until forced. * pt.c (processing_nonlambda_template): New. * call.c (build_this): Check it. * decl2.c (grok_array_decl): Call mark_rvalue_use and mark_lvalue_use_nonread. * init.c (constant_value_1): Don't call mark_rvalue_use. * typeck.c (build_static_cast): Handle lambda capture. From-SVN: r253266 --- gcc/cp/call.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/cp/call.c') diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 99a7b77..05dc8bb 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3362,7 +3362,7 @@ build_this (tree obj) { /* In a template, we are only concerned about the type of the expression, so we can take a shortcut. */ - if (processing_template_decl) + if (processing_nonlambda_template ()) return build_address (obj); return cp_build_addr_expr (obj, tf_warning_or_error); -- cgit v1.1