+2018-12-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/88103
+ * typeck.c (build_class_member_access_expr): If unary_complex_lvalue
+ turned xvalue_p into non-xvalue_p, call move on it.
+
2018-12-02 Jakub Jelinek <jakub@redhat.com>
PR c++/88258
{
tree temp = unary_complex_lvalue (ADDR_EXPR, object);
if (temp)
- object = cp_build_fold_indirect_ref (temp);
+ {
+ temp = cp_build_fold_indirect_ref (temp);
+ if (xvalue_p (object) && !xvalue_p (temp))
+ /* Preserve xvalue kind. */
+ temp = move (temp);
+ object = temp;
+ }
}
/* In [expr.ref], there is an explicit list of the valid choices for
+2018-12-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/88103
+ * g++.dg/cpp0x/rv-cond3.C: New test.
+
2018-12-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/88315
--- /dev/null
+// PR c++/88103
+// { dg-do compile { target c++11 } }
+
+struct A {
+ A (int);
+ A&& foo () &&;
+ int i;
+};
+void free (A&&);
+
+void test_xvalue (A a){
+ A&& ref = true ? static_cast<A&&> (a) : static_cast<A&&> (a);
+ free (true ? static_cast<A&&> (a) : static_cast<A&&> (a));
+ (true ? static_cast<A&&> (a) : static_cast<A&&> (a)).foo ();
+ int&& k = (true ? static_cast<A&&> (a) : static_cast<A&&> (a)).i;
+}
+void test_prvalue (A a){
+ A&& ref = true ? static_cast<A&&> (a) : 1;
+ free (true ? static_cast<A&&> (a) : 1);
+ (true ? static_cast<A&&> (a) : 1).foo ();
+ int&& k = (true ? static_cast<A&&> (a) : 1).i;
+}