aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-09-20 13:09:19 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-09-20 13:09:19 -0400
commit3ee378fb554de45f2415cabc7a1a50add5bbe17d (patch)
tree71d22d901a2014f06c47aabfb976d039b8b52bf9 /gcc/cp
parent8850966e26874356b7674516198d67f6384ca9d9 (diff)
downloadgcc-3ee378fb554de45f2415cabc7a1a50add5bbe17d.zip
gcc-3ee378fb554de45f2415cabc7a1a50add5bbe17d.tar.gz
gcc-3ee378fb554de45f2415cabc7a1a50add5bbe17d.tar.bz2
PR c++/87075 - ICE with constexpr array initialization.
My patch of 2016-08-26 to avoid calling a trivial default constructor introduced TARGET_EXPRs initialized with void_node to express trivial initialization. But when this shows up in a VEC_INIT_EXPR, we weren't prepared to handle it. Fixed by handling it explicitly in cxx_eval_vec_init_1. * constexpr.c (cxx_eval_vec_init_1): Handle trivial initialization. From-SVN: r264442
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/constexpr.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 75286d5..c5072d5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2018-09-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/87075 - ICE with constexpr array initialization.
+ * constexpr.c (cxx_eval_vec_init_1): Handle trivial initialization.
+
2018-09-19 Marek Polacek <polacek@redhat.com>
Add -Wclass-conversion.
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index aa33319..fdea769 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -3034,6 +3034,9 @@ cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init,
{
/* Initializing an element using value or default initialization
we just pre-built above. */
+ if (init == void_node)
+ /* Trivial default-init, don't do anything to the CONSTRUCTOR. */
+ return ctx->ctor;
eltinit = cxx_eval_constant_expression (&new_ctx, init, lval,
non_constant_p, overflow_p);
reuse = i == 0;