public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6381] c++: default mem-init of array [PR103946]
@ 2022-01-08  6:24 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2022-01-08  6:24 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:787d66eb6c53094161fb86e64ddf65f21389f63d

commit r12-6381-g787d66eb6c53094161fb86e64ddf65f21389f63d
Author: Jason Merrill <jason@redhat.com>
Date:   Sat Jan 8 01:18:51 2022 -0500

    c++: default mem-init of array [PR103946]
    
    In the patch for PR92385 I added asserts to see if we tried to make a
    vec_init of a vec_init, but didn't see any in regression testing.  This
    testcase is one case, which seems reasonable: we create a VEC_INIT_EXPR for
    the aggregate initializer, and then again to express the actual
    initialization of the member.  We already do similar collapsing of
    TARGET_EXPR.  So let's just remove the asserts.
    
            PR c++/103946
    
    gcc/cp/ChangeLog:
    
            * init.c (build_vec_init): Remove assert.
            * tree.c (build_vec_init_expr): Likewise.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/cpp0x/nsdmi-array1.C: New test.

Diff:
---
 gcc/cp/init.c                             | 5 +----
 gcc/cp/tree.c                             | 5 +----
 gcc/testsuite/g++.dg/cpp0x/nsdmi-array1.C | 6 ++++++
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 6226812b470..ccc4f5ece08 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -4369,10 +4369,7 @@ build_vec_init (tree base, tree maxindex, tree init,
     init = TARGET_EXPR_INITIAL (init);
 
   if (init && TREE_CODE (init) == VEC_INIT_EXPR)
-    {
-      gcc_checking_assert (false);
-      init = VEC_INIT_EXPR_INIT (init);
-    }
+    init = VEC_INIT_EXPR_INIT (init);
 
   bool direct_init = false;
   if (from_array && init && BRACE_ENCLOSED_INITIALIZER_P (init)
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 4c1135ba386..d0c6490e42f 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -787,10 +787,7 @@ tree
 build_vec_init_expr (tree type, tree init, tsubst_flags_t complain)
 {
   if (init && TREE_CODE (init) == VEC_INIT_EXPR)
-    {
-      gcc_checking_assert (false);
-      return init;
-    }
+    return init;
 
   tree elt_init;
   if (init && TREE_CODE (init) == CONSTRUCTOR
diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-array1.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-array1.C
new file mode 100644
index 00000000000..1ab14359b56
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-array1.C
@@ -0,0 +1,6 @@
+// PR c++/103946
+// { dg-do compile { target c++11 } }
+
+struct s1 {  s1(); };
+class s2 { s1 f1[2]{}; };
+s2 a;


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

only message in thread, other threads:[~2022-01-08  6:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-08  6:24 [gcc r12-6381] c++: default mem-init of array [PR103946] 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).