From caa7952a43833c6bd6b58d8432ec0a6ee1f0a945 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 22 Feb 2018 11:18:37 +0000 Subject: [PATCH] re PR c++/84493 (ICE with invalid cast) PR c++/84493 * parser.c (cp_parser_braced_list): Use require_open instead of consume_open. * g++.dg/parse/error59.C: New test. From-SVN: r257899 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/parse/error59.C | 6 ++++++ 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/parse/error59.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 76dce820aa8..f38f662f8f5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-02-22 Marek Polacek + + PR c++/84493 + * parser.c (cp_parser_braced_list): Use require_open instead of + consume_open. + 2018-02-21 Jason Merrill PR c++/84454 - ICE with pack expansion in signature. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 2bb0d2da5fe..4fa546a086c 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -21925,7 +21925,7 @@ cp_parser_braced_list (cp_parser* parser, bool* non_constant_p) /* Consume the `{' token. */ matching_braces braces; - braces.consume_open (parser); + braces.require_open (parser); /* Create a CONSTRUCTOR to represent the braced-initializer. */ initializer = make_node (CONSTRUCTOR); /* If it's not a `}', then there is a non-trivial initializer. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bb9a4170352..48826c7d35c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-02-22 Marek Polacek + + PR c++/84493 + * g++.dg/parse/error59.C: New test. + 2018-02-22 Tom de Vries * gcc.c-torture/execute/pr82210.c: Require effective target alloca. diff --git a/gcc/testsuite/g++.dg/parse/error59.C b/gcc/testsuite/g++.dg/parse/error59.C new file mode 100644 index 00000000000..2c44e210366 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/error59.C @@ -0,0 +1,6 @@ +// PR c++/84493 + +void foo() +{ + (struct {}x){}; // { dg-error "" } +} -- 2.30.2