aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/tree.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc
index aa9c1b7..6d968a2 100644
--- a/gcc/cp/tree.cc
+++ b/gcc/cp/tree.cc
@@ -104,7 +104,17 @@ lvalue_kind (const_tree ref)
case REALPART_EXPR:
case IMAGPART_EXPR:
case VIEW_CONVERT_EXPR:
- return lvalue_kind (TREE_OPERAND (ref, 0));
+ op1_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 0));
+ /* As for ARRAY_REF and COMPONENT_REF, these codes turn a class prvalue
+ into an xvalue: we need to materialize the temporary before we mess
+ with it. Except VIEW_CONVERT_EXPR that doesn't actually change the
+ type, as in location wrapper and REF_PARENTHESIZED_P. */
+ if (op1_lvalue_kind == clk_class
+ && !(TREE_CODE (ref) == VIEW_CONVERT_EXPR
+ && (same_type_ignoring_top_level_qualifiers_p
+ (TREE_TYPE (ref), TREE_TYPE (TREE_OPERAND (ref, 0))))))
+ return clk_rvalueref;
+ return op1_lvalue_kind;
case ARRAY_REF:
{