From 172f0e1311f23be40aeb4816f77793dc1317612d Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 21 Jul 2016 02:05:58 -0400 Subject: PR c++/70781 - ICE on ill-formed lambda. * parser.c (cp_parser_lambda_expression): Unset OK if there was an error parsing the lambda-declarator. From-SVN: r238563 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/parser.c | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'gcc/cp') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 78487ea..2e8877f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2016-07-21 Jason Merrill + PR c++/70781 + * parser.c (cp_parser_lambda_expression): Unset OK if there was an + error parsing the lambda-declarator. + PR c++/71896 * constexpr.c (cxx_eval_binary_expression): Handle comparison between lowered and unlowered PTRMEM_CST. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 9bdb108..b71b9e5 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -9771,10 +9771,12 @@ cp_parser_lambda_expression (cp_parser* parser) ok &= cp_parser_lambda_declarator_opt (parser, lambda_expr); + if (ok && cp_parser_error_occurred (parser)) + ok = false; + if (ok) { - if (!cp_parser_error_occurred (parser) - && cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE) + if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE) && cp_parser_start_tentative_firewall (parser)) start = token; cp_parser_lambda_body (parser, lambda_expr); -- cgit v1.1