From: Jason Merrill Date: Wed, 16 Jun 2021 21:42:15 +0000 (-0400) Subject: c++: Tweak PR101029 fix X-Git-Tag: releases/gcc-11.2.0~216 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da25516718cb150cc938f5947650c9ab486505c6;p=thirdparty%2Fgcc.git 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. --- diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 6126440cfae9..3c4aa5846d6b 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; }