2013-03-16 Jason Merrill <jason@redhat.com>
+ * parser.c (cp_parser_lambda_expression): Use nreverse.
+
PR c++/56447
PR c++/55532
* pt.c (instantiate_class_template_1): Instantiate lambda capture
cp_parser_skip_to_end_of_block_or_statement (parser);
/* The capture list was built up in reverse order; fix that now. */
- {
- tree newlist = NULL_TREE;
- tree elt, next;
-
- for (elt = LAMBDA_EXPR_CAPTURE_LIST (lambda_expr);
- elt; elt = next)
- {
- next = TREE_CHAIN (elt);
- TREE_CHAIN (elt) = newlist;
- newlist = elt;
- }
- LAMBDA_EXPR_CAPTURE_LIST (lambda_expr) = newlist;
- }
+ LAMBDA_EXPR_CAPTURE_LIST (lambda_expr)
+ = nreverse (LAMBDA_EXPR_CAPTURE_LIST (lambda_expr));
if (ok)
maybe_add_lambda_conv_op (type);