From 303484a73541ea7f41dff0238157924e49c255ff Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 19 Jan 2020 09:15:26 -0500 Subject: [PATCH] Simplify lambda parsing. Since we removed the special parsing for C++11 lambdas, it's just been an open-coded copy of cp_parser_function_body. So let's call it instead. This avoids the need to change this code in my revised 33799 patch. * parser.c (cp_parser_lambda_body): Use cp_parser_function_body. --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/parser.c | 20 ++++---------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 177a1b5..98a4d0f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2020-01-19 Jason Merrill + + * parser.c (cp_parser_lambda_body): Use cp_parser_function_body. + 2020-01-18 Jakub Jelinek * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 75e32fc..98c1beb 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -11141,23 +11141,11 @@ cp_parser_lambda_body (cp_parser* parser, tree lambda_expr) local_specialization_stack s (lss_copy); tree fco = lambda_function (lambda_expr); tree body = start_lambda_function (fco, lambda_expr); - matching_braces braces; - if (braces.require_open (parser)) - { - tree compound_stmt = begin_compound_stmt (0); - - /* Originally C++11 required us to peek for 'return expr'; and - process it specially here to deduce the return type. N3638 - removed the need for that. */ - - while (cp_lexer_next_token_is_keyword (parser->lexer, RID_LABEL)) - cp_parser_label_declaration (parser); - cp_parser_statement_seq_opt (parser, NULL_TREE); - braces.require_close (parser); - - finish_compound_stmt (compound_stmt); - } + /* Originally C++11 required us to peek for 'return expr'; and + process it specially here to deduce the return type. N3638 + removed the need for that. */ + cp_parser_function_body (parser, false); finish_lambda_function (body); } -- 2.7.4