From: Marek Polacek Date: Thu, 22 Feb 2018 11:18:37 +0000 (+0000) Subject: re PR c++/84493 (ICE with invalid cast) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=caa7952a43833c6bd6b58d8432ec0a6ee1f0a945;p=gcc.git 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 --- 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 "" } +}