From 7ab50e17943ee4caaf2fba2d4238a00e0409f1e7 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 6 Sep 2017 15:36:48 -0400 Subject: PR c++/82070 - error with nested lambda capture * pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with register_local_specialization. From-SVN: r251819 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'gcc/cp') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c154630..e497094 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-09-06 Jason Merrill + + PR c++/82070 - error with nested lambda capture + * pt.c (tsubst_expr) [DECL_EXPR]: Register capture proxies with + register_local_specialization. + 2017-09-06 Nathan Sidwell * name-lookup.h (lookup_field_1): Delete. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index eb27f6a..4a65e31 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -15985,8 +15985,11 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, else if (is_capture_proxy (decl) && !DECL_TEMPLATE_INSTANTIATION (current_function_decl)) { - /* We're in tsubst_lambda_expr, we've already inserted new capture - proxies, and uses will find them with lookup_name. */ + /* We're in tsubst_lambda_expr, we've already inserted a new + capture proxy, so look it up and register it. */ + tree inst = lookup_name (DECL_NAME (decl)); + gcc_assert (inst != decl && is_capture_proxy (inst)); + register_local_specialization (inst, decl); break; } else if (DECL_IMPLICIT_TYPEDEF_P (decl) -- cgit v1.1