diff options
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 3 | ||||
-rw-r--r-- | gcc/cp/parser.c | 3 | ||||
-rw-r--r-- | gcc/cp/pt.c | 3 |
4 files changed, 10 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e90d12d..baa4899 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-06-17 Jason Merrill <jason@redhat.com> + * parser.c (cp_parser_lambda_expression): Clear + LAMBDA_EXPR_THIS_CAPTURE after parsing. + * pt.c (tsubst_copy_and_build): Make sure it isn't set. + * cp-tree.h (struct tree_lambda_expr): Change common to typed. Move non-pointers to end of struct. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index ee303fe..cf1c592 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -625,7 +625,8 @@ enum cp_lambda_default_capture_mode_type { #define LAMBDA_EXPR_CAPTURE_LIST(NODE) \ (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->capture_list) -/* The node in the capture-list that holds the 'this' capture. */ +/* During parsing of the lambda, the node in the capture-list that holds + the 'this' capture. */ #define LAMBDA_EXPR_THIS_CAPTURE(NODE) \ (((struct tree_lambda_expr *)LAMBDA_EXPR_CHECK (NODE))->this_capture) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 5ea04b5..a9cedcf 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -7430,6 +7430,9 @@ cp_parser_lambda_expression (cp_parser* parser) pop_deferring_access_checks (); + /* This field is only used during parsing of the lambda. */ + LAMBDA_EXPR_THIS_CAPTURE (lambda_expr) = NULL_TREE; + if (ok) return build_lambda_object (lambda_expr); else diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 308aff7..ca4f955 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13498,10 +13498,9 @@ tsubst_copy_and_build (tree t, = (LAMBDA_EXPR_DISCRIMINATOR (t)); LAMBDA_EXPR_CAPTURE_LIST (r) = RECUR (LAMBDA_EXPR_CAPTURE_LIST (t)); - LAMBDA_EXPR_THIS_CAPTURE (r) - = RECUR (LAMBDA_EXPR_THIS_CAPTURE (t)); LAMBDA_EXPR_EXTRA_SCOPE (r) = RECUR (LAMBDA_EXPR_EXTRA_SCOPE (t)); + gcc_assert (LAMBDA_EXPR_THIS_CAPTURE (t) == NULL_TREE); /* Do this again now that LAMBDA_EXPR_EXTRA_SCOPE is set. */ determine_visibility (TYPE_NAME (type)); |