https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127710

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Candidate fix:

--- a/gcc/cp/cvt.cc
+++ b/gcc/cp/cvt.cc
@@ -580,7 +580,13 @@ force_rvalue (tree expr, tsubst_flags_t complain)
 tree
 force_lvalue (tree expr, tsubst_flags_t complain)
 {
-  if (!lvalue_p (expr))
+  if (lvalue_p (expr))
+    return expr;
+
+  if (TREE_CODE (expr) == TARGET_EXPR)
+    expr = build2 (COMPOUND_EXPR, TREE_TYPE (expr), expr,
+          TARGET_EXPR_SLOT (expr));
+  else
     {
       expr = cp_build_addr_expr (expr, complain);
       expr = cp_build_indirect_ref (input_location, expr, RO_ARROW, complain);

(this is taken from cp_build_modify_expr)

Reply via email to