+2010-10-22 Jason Merrill <jason@redhat.com>
+
+ PR c++/46103
+ * init.c (build_vec_init): Handle memberwise move.
+
2010-10-21 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/46117
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);
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);
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;
--- /dev/null
+// PR c++/46103
+// { dg-options -std=c++0x }
+
+struct MoveOnly {
+ MoveOnly(const MoveOnly&) = delete;
+ MoveOnly(MoveOnly&&) { }
+ MoveOnly() = default;
+};
+
+struct A {
+ MoveOnly mo[1];
+ A() = default;
+ A(A&&) = default;
+};
+
+int main() {
+ A a;
+ A aa = static_cast<A&&>(a);
+}