diff options
author | Jason Merrill <jason@redhat.com> | 2010-10-22 14:37:41 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-10-22 14:37:41 -0400 |
commit | f91352dcc350244cdfecca727b9daf2a652f0bea (patch) | |
tree | 6d779be93f457c0ed9fb8e6b01d6f2a1eafe78f1 /gcc/cp/init.c | |
parent | 4490cae6cb0679e404462dd6ed2f3fca67f1b2ff (diff) | |
download | gcc-f91352dcc350244cdfecca727b9daf2a652f0bea.zip gcc-f91352dcc350244cdfecca727b9daf2a652f0bea.tar.gz gcc-f91352dcc350244cdfecca727b9daf2a652f0bea.tar.bz2 |
re PR c++/46103 ([c++0x] moving from std::array copies the elements)
PR c++/46103
* init.c (build_vec_init): Handle memberwise move.
From-SVN: r165849
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 5091d4e..72fcf78 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2849,6 +2849,7 @@ build_vec_init (tree base, tree maxindex, tree init, tree try_block = NULL_TREE; int num_initialized_elts = 0; bool is_global; + bool xvalue = false; if (TREE_CODE (atype) == ARRAY_TYPE && TYPE_DOMAIN (atype)) maxindex = array_type_nelts (atype); @@ -2939,6 +2940,8 @@ build_vec_init (tree base, tree maxindex, tree init, checking. Evaluate the initializer before entering the try block. */ if (from_array && init && TREE_CODE (init) != CONSTRUCTOR) { + if (lvalue_kind (init) & clk_rvalueref) + xvalue = true; base2 = decay_conversion (init); itype = TREE_TYPE (base2); base2 = get_temp_regvar (itype, base2); @@ -3033,7 +3036,11 @@ build_vec_init (tree base, tree maxindex, tree init, tree from; if (base2) - from = build1 (INDIRECT_REF, itype, base2); + { + from = build1 (INDIRECT_REF, itype, base2); + if (xvalue) + from = move (from); + } else from = NULL_TREE; |