public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1548] c++: Tweak PR101029 fix
@ 2021-06-17  3:38 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2021-06-17  3:38 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ff4deb4b1d0c5947669ddc76fde4db83e28009d8

commit r12-1548-gff4deb4b1d0c5947669ddc76fde4db83e28009d8
Author: Jason Merrill <jason@redhat.com>
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 622d6e9d0c5..4bd942f3f74 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;
     }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-17  3:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17  3:38 [gcc r12-1548] c++: Tweak PR101029 fix Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).