aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2021-06-16 17:42:15 -0400
committerJason Merrill <jason@redhat.com>2021-06-16 23:38:32 -0400
commitff4deb4b1d0c5947669ddc76fde4db83e28009d8 (patch)
tree922618349cebb30488c529380f2d3c59318181a3 /gcc
parent9a61dfdb5ecb58bc4caea1c11e017d93bdd1d9a5 (diff)
downloadgcc-ff4deb4b1d0c5947669ddc76fde4db83e28009d8.zip
gcc-ff4deb4b1d0c5947669ddc76fde4db83e28009d8.tar.gz
gcc-ff4deb4b1d0c5947669ddc76fde4db83e28009d8.tar.bz2
c++: Tweak PR101029 fix
The case of an initializer with side effects for a zero-length array seems extremely unlikely, but we should still return the right type in that case. PR c++/101029 gcc/cp/ChangeLog: * init.c (build_vec_init): Preserve the type of base.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 622d6e9..4bd942f 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -4226,7 +4226,7 @@ build_vec_init (tree base, tree maxindex, tree init,
{
/* Shortcut zero element case to avoid unneeded constructor synthesis. */
if (init && TREE_SIDE_EFFECTS (init))
- base = build2 (COMPOUND_EXPR, void_type_node, init, base);
+ base = build2 (COMPOUND_EXPR, ptype, init, base);
return base;
}