diff options
author | Jason Merrill <jason@redhat.com> | 2017-09-28 15:39:38 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-09-28 15:39:38 -0400 |
commit | 5c263e84ab7e5df28a9055ae533c2d305f4b7b3d (patch) | |
tree | b86cb1ba622a88cf4a14e1fd0e4b03bc38df3be7 /gcc/cp/semantics.c | |
parent | 697a7a575de01835b3941e6b6d25b940033301d5 (diff) | |
download | gcc-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/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 3a3ae55..4e87e47 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -3303,16 +3303,19 @@ process_outer_var_ref (tree decl, tsubst_flags_t complain) if (parsing_nsdmi ()) containing_function = NULL_TREE; - if (containing_function && DECL_TEMPLATE_INFO (context) - && LAMBDA_FUNCTION_P (containing_function)) - { - /* Check whether we've already built a proxy; - insert_pending_capture_proxies doesn't update - local_specializations. */ - tree d = lookup_name (DECL_NAME (decl)); - if (d && is_capture_proxy (d) - && DECL_CONTEXT (d) == containing_function) - return d; + if (containing_function && LAMBDA_FUNCTION_P (containing_function)) + { + /* Check whether we've already built a proxy. */ + tree d = retrieve_local_specialization (decl); + if (d && is_capture_proxy (d)) + { + if (DECL_CONTEXT (d) == containing_function) + /* We already have an inner proxy. */ + return d; + else + /* We need to capture an outer proxy. */ + return process_outer_var_ref (d, complain); + } } /* If we are in a lambda function, we can move out until we hit |