re PR c++/87324 (g++ ICE with overriding initializers: Segmentation fault)
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 19 Sep 2018 19:35:19 +0000 (19:35 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 19 Sep 2018 19:35:19 +0000 (19:35 +0000)
/cp
2018-09-19  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/87324
* parser.c (cp_parser_initializer_list): Assign error_mark_node
to the index upon error.

/testsuite
2018-09-19  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/87324
* g++.dg/cpp0x/desig5.C: New.

From-SVN: r264428

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/desig5.C [new file with mode: 0644]

index 7fcb34605c1190e32948821519976beef003e2ab..546943c9a0eb5380ac9d71cbd629bc157816550e 100644 (file)
@@ -1,3 +1,9 @@
+2018-09-19  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/87324
+       * parser.c (cp_parser_initializer_list): Assign error_mark_node
+       to the index upon error.
+
 2018-09-19  Marek Polacek  <polacek@redhat.com>
 
        PR c++/87357 - missing -Wconversion warning
index f5e4fa4ff0730b378080791d733b05e23228691d..6e68f2c41dc406153683f7895abe9d67615bb3c3 100644 (file)
@@ -22394,7 +22394,7 @@ cp_parser_initializer_list (cp_parser* parser, bool* non_constant_p)
                          "%<.%s%> designator used multiple times in "
                          "the same initializer list",
                          IDENTIFIER_POINTER (designator));
-               (*v)[i].index = NULL_TREE;
+               (*v)[i].index = error_mark_node;
              }
            else
              IDENTIFIER_MARKED (designator) = 1;
index 4631448bb67f3246a8fd1cac7c8749b380aa922a..f3b55d157f8052b910c6e00795413b05fb65e29a 100644 (file)
@@ -1,3 +1,8 @@
+2018-09-19  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/87324
+       * g++.dg/cpp0x/desig5.C: New.
+
 2018-09-19  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/84109
diff --git a/gcc/testsuite/g++.dg/cpp0x/desig5.C b/gcc/testsuite/g++.dg/cpp0x/desig5.C
new file mode 100644 (file)
index 0000000..ed27629
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/87324
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wno-pedantic" }
+
+struct {
+  struct {
+    double a;
+    struct {
+      short b;
+    };
+  };
+  int c;
+} d{.a = 7, .a = 8.09};  // { dg-error "designator used multiple times in the same initializer list" }