2019-08-30 Jakub Jelinek <jakub@redhat.com>
-
+
Backported from mainline
+ 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-11-27 Jakub Jelinek <jakub@redhat.com>
PR c++/88181
{
tree temp = unary_complex_lvalue (ADDR_EXPR, object);
if (temp)
- object = cp_build_indirect_ref (temp, RO_NULL, complain);
+ {
+ temp = cp_build_indirect_ref (temp, RO_NULL, complain);
+ 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
2019-08-30 Jakub Jelinek <jakub@redhat.com>
-
+
Backported from mainline
+ 2018-12-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/88103
+ * g++.dg/cpp0x/rv-cond3.C: New test.
+
2018-12-03 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/71109
--- /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;
+}