From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2122) id E4237383D02E; Thu, 17 Jun 2021 03:39:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4237383D02E MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jason Merrill To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-8586] c++: Tweak PR101029 fix X-Act-Checkin: gcc X-Git-Author: Jason Merrill X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: f5402be3deada75c3d957cb554c26b659dee5801 X-Git-Newrev: da25516718cb150cc938f5947650c9ab486505c6 Message-Id: <20210617033902.E4237383D02E@sourceware.org> Date: Thu, 17 Jun 2021 03:39:02 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jun 2021 03:39:03 -0000 https://gcc.gnu.org/g:da25516718cb150cc938f5947650c9ab486505c6 commit r11-8586-gda25516718cb150cc938f5947650c9ab486505c6 Author: Jason Merrill Date: Wed Jun 16 17:42:15 2021 -0400 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: --- gcc/cp/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 6126440cfae..3c4aa5846d6 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; }