OSDN Git Service

* parser.c (cp_parser_lambda_expression): Clear
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 17 Jun 2011 20:07:45 +0000 (20:07 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 17 Jun 2011 20:07:45 +0000 (20:07 +0000)
LAMBDA_EXPR_THIS_CAPTURE after parsing.
* pt.c (tsubst_copy_and_build): Make sure it isn't set.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175156 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/parser.c
gcc/cp/pt.c

index e90d12d..baa4899 100644 (file)
@@ -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.
 
index ee303fe..cf1c592 100644 (file)
@@ -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)
 
index 5ea04b5..a9cedcf 100644 (file)
@@ -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
index 308aff7..ca4f955 100644 (file)
@@ -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));