re PR c++/84493 (ICE with invalid cast)
authorMarek Polacek <polacek@redhat.com>
Thu, 22 Feb 2018 11:18:37 +0000 (11:18 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 22 Feb 2018 11:18:37 +0000 (11:18 +0000)
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
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/error59.C [new file with mode: 0644]

index 76dce820aa8d0283e7006fa78a25d4227270701d..f38f662f8f5c196940468bea5461a2b799e2c323 100644 (file)
@@ -1,3 +1,9 @@
+2018-02-22  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/84493
+       * parser.c (cp_parser_braced_list): Use require_open instead of
+       consume_open.
+
 2018-02-21  Jason Merrill  <jason@redhat.com>
 
        PR c++/84454 - ICE with pack expansion in signature.
index 2bb0d2da5fec319e66747b9e4ecd14cf3a353dab..4fa546a086cc69a787b947c5e37b2c4bf31c4286 100644 (file)
@@ -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.  */
index bb9a417035220774f5b98ae9f15239279d34b770..48826c7d35cc09353a78f830e8e24661d6fc258d 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-22  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/84493
+       * g++.dg/parse/error59.C: New test.
+
 2018-02-22  Tom de Vries  <tom@codesourcery.com>
 
        * 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 (file)
index 0000000..2c44e21
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/84493
+
+void foo()
+{
+  (struct {}x){}; // { dg-error "" }
+}