diff options
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index a581e88..d844d15 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -9264,7 +9264,15 @@ cp_parser_expression_statement (cp_parser* parser, tree in_statement_expr) /* If the next token is a ';', then there is no expression statement. */ if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON)) - statement = cp_parser_expression (parser, /*cast_p=*/false, NULL); + { + statement = cp_parser_expression (parser, /*cast_p=*/false, NULL); + if (statement == error_mark_node + && !cp_parser_uncommitted_to_tentative_parse_p (parser)) + { + cp_parser_skip_to_end_of_block_or_statement (parser); + return error_mark_node; + } + } /* Give a helpful message for "A<T>::type t;" and the like. */ if (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON) |