Commit 23823e0a by Jason Merrill Committed by Jason Merrill

* parser.c (cp_parser_lambda_expression): Don't add __ to __this.

From-SVN: r152330
parent bfd6b23c
2009-09-30 Jason Merrill <jason@redhat.com>
* parser.c (cp_parser_lambda_expression): Don't add __ to __this.
2009-09-30 Jason Merrill <jason@redhat.com>
* cp-tree.h (LANG_DECL_U2_CHECK): Check LANG_DECL_HAS_MIN.
2009-09-29 John Freeman <jfreeman08@gmail.com>
......
......@@ -7077,21 +7077,26 @@ cp_parser_lambda_expression (cp_parser* parser)
for (elt = LAMBDA_EXPR_CAPTURE_LIST (lambda_expr);
elt; elt = next)
{
tree field = TREE_PURPOSE (elt);
char *buf;
next = TREE_CHAIN (elt);
TREE_CHAIN (elt) = newlist;
newlist = elt;
/* Also add __ to the beginning of the field name so that code
outside the lambda body can't see the captured name. We could
just remove the name entirely, but this is more useful for
debugging. */
tree field = TREE_PURPOSE (elt);
char *buf
= (char *) alloca (IDENTIFIER_LENGTH (DECL_NAME (field)) + 3);
if (field == LAMBDA_EXPR_THIS_CAPTURE (lambda_expr))
/* The 'this' capture already starts with __. */
continue;
buf = (char *) alloca (IDENTIFIER_LENGTH (DECL_NAME (field)) + 3);
buf[1] = buf[0] = '_';
memcpy (buf + 2, IDENTIFIER_POINTER (DECL_NAME (field)),
IDENTIFIER_LENGTH (DECL_NAME (field)) + 1);
DECL_NAME (field) = get_identifier (buf);
next = TREE_CHAIN (elt);
TREE_CHAIN (elt) = newlist;
newlist = elt;
}
LAMBDA_EXPR_CAPTURE_LIST (lambda_expr) = newlist;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment