From e9f3968bbe670a0b54516a29ca9ffb7c79c6cb20 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 16 Mar 2013 22:35:36 -0400 Subject: [PATCH] * parser.c (cp_parser_lambda_expression): Use nreverse. From-SVN: r196730 --- gcc/cp/ChangeLog | 2 ++ gcc/cp/parser.c | 15 ++------------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 59d6e8aad76..de8f0307f2d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,7 @@ 2013-03-16 Jason Merrill + * parser.c (cp_parser_lambda_expression): Use nreverse. + PR c++/56447 PR c++/55532 * pt.c (instantiate_class_template_1): Instantiate lambda capture diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 0a3740db6db..f4149323e4d 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -8195,19 +8195,8 @@ cp_parser_lambda_expression (cp_parser* parser) 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); -- 2.30.2