]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/92524 (ICE in short program with constexpr and std::array)
authorJakub Jelinek <jakub@redhat.com>
Fri, 20 Dec 2019 17:24:30 +0000 (18:24 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 20 Dec 2019 17:24:30 +0000 (18:24 +0100)
Backported from mainline
2019-11-27  Jakub Jelinek  <jakub@redhat.com>

PR c++/92524
* tree.c (replace_placeholders_r): Don't walk constructor elts with
RANGE_EXPR indexes.

* g++.dg/cpp0x/pr92524.C: New test.

From-SVN: r279659

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

index 01dad30b3ef60c0c3fd555cb3def74e203175359..83a9adc288a887bc5afa3bde4ee48b763534b454 100644 (file)
@@ -1,6 +1,12 @@
 2019-12-20  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-11-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/92524
+       * tree.c (replace_placeholders_r): Don't walk constructor elts with
+       RANGE_EXPR indexes.
+
        2019-11-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/92648
index ae9bfd24cfb6be9938fe35933954b77e17588861..7275b7bf5b0025759f204b4888aae78e36fdddf7 100644 (file)
@@ -3123,6 +3123,11 @@ replace_placeholders_r (tree* t, int* walk_subtrees, void* data_)
            tree type = TREE_TYPE (*valp);
            tree subob = obj;
 
+           /* Elements with RANGE_EXPR index shouldn't have any
+              placeholders in them.  */
+           if (ce->index && TREE_CODE (ce->index) == RANGE_EXPR)
+             continue;
+
            if (TREE_CODE (*valp) == CONSTRUCTOR
                && AGGREGATE_TYPE_P (type))
              {
index 57d96f0439caf3b460b36e7a2cd278ae9e0b91dd..22a9462d32c8ed93bbe169a924d5e9199f35b5c3 100644 (file)
@@ -1,6 +1,11 @@
 2019-12-20  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-11-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/92524
+       * g++.dg/cpp0x/pr92524.C: New test.
+
        2019-11-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/92648
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr92524.C b/gcc/testsuite/g++.dg/cpp0x/pr92524.C
new file mode 100644 (file)
index 0000000..ffbcd8f
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/92524
+// { dg-do compile { target c++11 } }
+
+struct A { char a = '*'; };
+struct B { A b[64]; };
+
+void
+foo ()
+{
+  A a;
+  B{a};
+}