From: Jakub Jelinek Date: Fri, 20 Dec 2019 17:24:30 +0000 (+0100) Subject: backport: re PR c++/92524 (ICE in short program with constexpr and std::array) X-Git-Tag: releases/gcc-9.3.0~294 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f62d72ac7042d088fc173166568a13b907ec9c64;p=thirdparty%2Fgcc.git backport: re PR c++/92524 (ICE in short program with constexpr and std::array) Backported from mainline 2019-11-27 Jakub Jelinek 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 01dad30b3ef6..83a9adc288a8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,12 @@ 2019-12-20 Jakub Jelinek Backported from mainline + 2019-11-27 Jakub Jelinek + + PR c++/92524 + * tree.c (replace_placeholders_r): Don't walk constructor elts with + RANGE_EXPR indexes. + 2019-11-26 Jakub Jelinek PR c++/92648 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index ae9bfd24cfb6..7275b7bf5b00 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -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)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 57d96f0439ca..22a9462d32c8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-12-20 Jakub Jelinek Backported from mainline + 2019-11-27 Jakub Jelinek + + PR c++/92524 + * g++.dg/cpp0x/pr92524.C: New test. + 2019-11-26 Jakub Jelinek 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 index 000000000000..ffbcd8f9f3ab --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr92524.C @@ -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}; +}