summaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-02-11 02:12:53 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-02-11 02:12:53 +0000
commit86b604cfd0917da33b295d4c4d8892c7619994b7 (patch)
treec026a8558e03de540d0342d079d43fa8908967e5 /gcc/cp/parser.c
parent2c289d8992907387c954c22d3770e562a625879b (diff)
downloadgcc-86b604cfd0917da33b295d4c4d8892c7619994b7.tar.gz
PR c++/41896
* semantics.c (outer_lambda_capture_p): Revert. (add_capture): Only finish_member_declaration if we're in the lambda class. (register_capture_members): New. * cp-tree.h: Declare it. * parser.c (cp_parser_lambda_expression): Call it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156678 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 5256883565f..690f2c05eb0 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -7072,6 +7072,8 @@ cp_parser_lambda_expression (cp_parser* parser)
it now. */
push_deferring_access_checks (dk_no_deferred);
+ cp_parser_lambda_introducer (parser, lambda_expr);
+
type = begin_lambda_type (lambda_expr);
record_lambda_scope (lambda_expr);
@@ -7079,6 +7081,10 @@ cp_parser_lambda_expression (cp_parser* parser)
/* Do this again now that LAMBDA_EXPR_EXTRA_SCOPE is set. */
determine_visibility (TYPE_NAME (type));
+ /* Now that we've started the type, add the capture fields for any
+ explicit captures. */
+ register_capture_members (LAMBDA_EXPR_CAPTURE_LIST (lambda_expr));
+
{
/* Inside the class, surrounding template-parameter-lists do not apply. */
unsigned int saved_num_template_parameter_lists
@@ -7086,8 +7092,6 @@ cp_parser_lambda_expression (cp_parser* parser)
parser->num_template_parameter_lists = 0;
- cp_parser_lambda_introducer (parser, lambda_expr);
-
/* By virtue of defining a local class, a lambda expression has access to
the private variables of enclosing classes. */