aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-09-28 15:39:38 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-09-28 15:39:38 -0400
commit5c263e84ab7e5df28a9055ae533c2d305f4b7b3d (patch)
treeb86cb1ba622a88cf4a14e1fd0e4b03bc38df3be7 /gcc/cp/pt.c
parent697a7a575de01835b3941e6b6d25b940033301d5 (diff)
downloadgcc-5c263e84ab7e5df28a9055ae533c2d305f4b7b3d.zip
gcc-5c263e84ab7e5df28a9055ae533c2d305f4b7b3d.tar.gz
gcc-5c263e84ab7e5df28a9055ae533c2d305f4b7b3d.tar.bz2
Use local_specializations to find capture proxies.
* cp-tree.h (DECL_CAPTURED_VARIABLE): New. * lambda.c (build_capture_proxy): Set it. (add_capture): Pass initializer to build_capture_proxy. (start_lambda_function): Likewise. (insert_capture_proxy): Use register_local_specialization. (is_lambda_ignored_entity): Always ignore proxies. * name-lookup.c (qualify_lookup): Don't check is_lambda_ignored_entity if LOOKUP_HIDDEN is set. * semantics.c (process_outer_var_ref): Use retrieve_local_specialization. * parser.c (cp_parser_lambda_body): Push local_specializations. * pt.c (tsubst_expr): Pass LOOKUP_HIDDEN when looking for a proxy. (tsubst_lambda_expr): Push local_specializations sooner. (tsubst_copy_and_build): Don't register_local_specialization. From-SVN: r253265
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f12ab26..2bdac6d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -15986,7 +15986,8 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
{
/* 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));
+ tree inst = lookup_name_real (DECL_NAME (decl), 0, 0,
+ /*block_p=*/true, 0, LOOKUP_HIDDEN);
gcc_assert (inst != decl && is_capture_proxy (inst));
register_local_specialization (inst, decl);
break;
@@ -16906,10 +16907,10 @@ tsubst_lambda_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (nested)
push_function_context ();
- tree body = start_lambda_function (fn, r);
-
local_specialization_stack s (lss_copy);
+ tree body = start_lambda_function (fn, r);
+
register_parameter_specializations (oldfn, fn);
tsubst_expr (DECL_SAVED_TREE (oldfn), args, complain, r,
@@ -18136,11 +18137,7 @@ tsubst_copy_and_build (tree t,
r = build_cxx_call (wrap, 0, NULL, tf_warning_or_error);
}
else if (outer_automatic_var_p (r))
- {
- r = process_outer_var_ref (r, complain);
- if (is_capture_proxy (r) && !DECL_PACK_P (t))
- register_local_specialization (r, t);
- }
+ r = process_outer_var_ref (r, complain);
if (TREE_CODE (TREE_TYPE (t)) != REFERENCE_TYPE)
/* If the original type was a reference, we'll be wrapped in