[pushed] c++: default mem-init of array [PR103946]
Commit Message
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.
---
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(-)
create mode 100644 gcc/testsuite/g++.dg/cpp0x/nsdmi-array1.C
base-commit: 75047f795111150fd10a8f86f5c72deab10cde77
@@ -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)
@@ -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
new file mode 100644
@@ -0,0 +1,6 @@
+// PR c++/103946
+// { dg-do compile { target c++11 } }
+
+struct s1 { s1(); };
+class s2 { s1 f1[2]{}; };
+s2 a;