aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-09-28 15:39:45 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-09-28 15:39:45 -0400
commit281e6c1d8f1b4ca552d8ce2276ddecfcd6ffb15e (patch)
tree4ec4cc5dfce6282bcbc8d1adfbbb092073395b53 /gcc/cp/call.c
parent5c263e84ab7e5df28a9055ae533c2d305f4b7b3d (diff)
downloadgcc-281e6c1d8f1b4ca552d8ce2276ddecfcd6ffb15e.zip
gcc-281e6c1d8f1b4ca552d8ce2276ddecfcd6ffb15e.tar.gz
gcc-281e6c1d8f1b4ca552d8ce2276ddecfcd6ffb15e.tar.bz2
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
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c2
1 files changed, 1 insertions, 1 deletions
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);