aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-04-09 21:48:48 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2018-04-09 21:48:48 +0200
commit6e4f1148ce233f2533d56ab20dc002dc1e9a83d7 (patch)
treefaae88665bf0190c1852a3b6d54031e3d88922f6 /gcc/cp/parser.c
parent78c3f9becd0e7d918806735d721961afd865d1df (diff)
downloadgcc-6e4f1148ce233f2533d56ab20dc002dc1e9a83d7.zip
gcc-6e4f1148ce233f2533d56ab20dc002dc1e9a83d7.tar.gz
gcc-6e4f1148ce233f2533d56ab20dc002dc1e9a83d7.tar.bz2
re PR c++/85194 (ICE with structured binding in broken for-loop)
PR c++/85194 * parser.c (cp_parser_simple_declaration): For structured bindings, if *maybe_range_for_decl is NULL after parsing it, set it to error_mark_node. * g++.dg/cpp1z/decomp43.C: New test. From-SVN: r259252
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 0ffa13d..9c8a886 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -12983,8 +12983,14 @@ cp_parser_simple_declaration (cp_parser* parser,
/* The next token should be either a `,' or a `;'. */
cp_token *token = cp_lexer_peek_token (parser->lexer);
/* If it's a `;', we are done. */
- if (token->type == CPP_SEMICOLON || maybe_range_for_decl)
+ if (token->type == CPP_SEMICOLON)
goto finish;
+ else if (maybe_range_for_decl)
+ {
+ if (*maybe_range_for_decl == NULL_TREE)
+ *maybe_range_for_decl = error_mark_node;
+ goto finish;
+ }
/* Anything else is an error. */
else
{