re PR c++/92524 (ICE in short program with constexpr and std::array)
authorJakub Jelinek <jakub@redhat.com>
Wed, 27 Nov 2019 09:04:40 +0000 (10:04 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 27 Nov 2019 09:04:40 +0000 (10:04 +0100)
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: r278759

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

index 6cf8579377d9c33fd7288ecc6413f7b5655865e2..4cbdb4352dc467927827c7256e64a30d522121c5 100644 (file)
@@ -1,3 +1,9 @@
+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  Jason Merrill  <jason@redhat.com>
 
        * pt.c (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Remember the
index 6c39c004b011d1d0ff0332caf1cdfdf914741717..d125d60b270676b7b4267c22a8f125737bbefd42 100644 (file)
@@ -3144,6 +3144,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 df74ba61243539b5a0a2d8c1588ec09b92349b21..ab455910c4df4a8c2e26e25a4bffdee3f71e713e 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/92524
+       * g++.dg/cpp0x/pr92524.C: New test.
+
 2019-11-27  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/92645
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};
+}