summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-07 01:44:11 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-07 01:44:11 +0000
commit2cc4f948785d85150620779dbac4005f3874d663 (patch)
tree8df901f206f63e19bf29c57e778ffcda9b96c284 /gcc
parent01259852a07f0c379df3f0437f34fefd67115534 (diff)
downloadgcc-2cc4f948785d85150620779dbac4005f3874d663.tar.gz
PR c++/60417
* init.c (build_vec_init): Reorganize earlier change a bit. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213689 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/init.c40
2 files changed, 23 insertions, 20 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9ffd7468563..a373ccfe95c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2014-08-06 Jason Merrill <jason@redhat.com>
+ PR c++/60417
+ * init.c (build_vec_init): Reorganize earlier change a bit.
+
PR c++/61994
* init.c (build_vec_init): Leave atype an ARRAY_TYPE
if we're just returning an INIT_EXPR.
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 17e6c4becb5..777e0a984e4 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -3685,26 +3685,6 @@ build_vec_init (tree base, tree maxindex, tree init,
}
}
- /* If the initializer is {}, then all elements are initialized from T{}.
- But for non-classes, that's the same as value-initialization. */
- if (empty_list)
- {
- if (cxx_dialect >= cxx11 && AGGREGATE_TYPE_P (type))
- {
- if (BRACE_ENCLOSED_INITIALIZER_P (init)
- && CONSTRUCTOR_NELTS (init) == 0)
- /* Reuse it. */;
- else
- init = build_constructor (init_list_type_node, NULL);
- CONSTRUCTOR_IS_DIRECT_INIT (init) = true;
- }
- else
- {
- init = NULL_TREE;
- explicit_value_init_p = true;
- }
- }
-
/* Now, default-initialize any remaining elements. We don't need to
do that if a) the type does not need constructing, or b) we've
already initialized all the elements.
@@ -3736,6 +3716,26 @@ build_vec_init (tree base, tree maxindex, tree init,
to = build1 (INDIRECT_REF, type, base);
+ /* If the initializer is {}, then all elements are initialized from T{}.
+ But for non-classes, that's the same as value-initialization. */
+ if (empty_list)
+ {
+ if (cxx_dialect >= cxx11 && AGGREGATE_TYPE_P (type))
+ {
+ if (BRACE_ENCLOSED_INITIALIZER_P (init)
+ && CONSTRUCTOR_NELTS (init) == 0)
+ /* Reuse it. */;
+ else
+ init = build_constructor (init_list_type_node, NULL);
+ CONSTRUCTOR_IS_DIRECT_INIT (init) = true;
+ }
+ else
+ {
+ init = NULL_TREE;
+ explicit_value_init_p = true;
+ }
+ }
+
if (from_array)
{
tree from;