View | Details | Return to bug 67064
Collapse All | Expand All

(-)a/gcc/cp/call.c (-2 lines)
Lines 5131-5138 build_conditional_expr_1 (location_t loc, tree arg1, tree arg2, tree arg3, Link Here
5131
	 lvalue, we must add a NON_LVALUE_EXPR.  */
5131
	 lvalue, we must add a NON_LVALUE_EXPR.  */
5132
      result = rvalue (result);
5132
      result = rvalue (result);
5133
    }
5133
    }
5134
  else
5135
    result = force_paren_expr (result);
5136
5134
5137
  return result;
5135
  return result;
5138
}
5136
}
(-)a/gcc/cp/cp-tree.h (-1 lines)
Lines 5933-5939 extern tree finish_asm_stmt (int, tree, tree, tree, tree, Link Here
5933
extern tree finish_label_stmt			(tree);
5933
extern tree finish_label_stmt			(tree);
5934
extern void finish_label_decl			(tree);
5934
extern void finish_label_decl			(tree);
5935
extern tree finish_parenthesized_expr		(tree);
5935
extern tree finish_parenthesized_expr		(tree);
5936
extern tree force_paren_expr			(tree);
5937
extern tree finish_non_static_data_member       (tree, tree, tree);
5936
extern tree finish_non_static_data_member       (tree, tree, tree);
5938
extern tree begin_stmt_expr			(void);
5937
extern tree begin_stmt_expr			(void);
5939
extern tree finish_stmt_expr_expr		(tree, tree);
5938
extern tree finish_stmt_expr_expr		(tree, tree);
(-)a/gcc/cp/semantics.c (-25 / +6 lines)
Lines 1642-1667 finish_mem_initializers (tree mem_inits) Link Here
1642
    emit_mem_initializers (mem_inits);
1642
    emit_mem_initializers (mem_inits);
1643
}
1643
}
1644
1644
1645
/* Obfuscate EXPR if it looks like an id-expression or member access so
1645
static void
1646
   that the call to finish_decltype in do_auto_deduction will give the
1646
check_paren_expr(tree expr)
1647
   right result.  */
1648
1649
tree
1650
force_paren_expr (tree expr)
1651
{
1647
{
1652
  /* This is only needed for decltype(auto) in C++14.  */
1653
  if (cxx_dialect < cxx14)
1654
    return expr;
1655
1656
  /* If we're in unevaluated context, we can't be deducing a
1657
     return/initializer type, so we don't need to mess with this.  */
1658
  if (cp_unevaluated_operand)
1659
    return expr;
1660
1661
  if (!DECL_P (expr) && TREE_CODE (expr) != COMPONENT_REF
1662
      && TREE_CODE (expr) != SCOPE_REF)
1663
    return expr;
1664
1665
  if (TREE_CODE (expr) == COMPONENT_REF)
1648
  if (TREE_CODE (expr) == COMPONENT_REF)
1666
    REF_PARENTHESIZED_P (expr) = true;
1649
    REF_PARENTHESIZED_P (expr) = true;
1667
  else if (type_dependent_expression_p (expr))
1650
  else if (type_dependent_expression_p (expr))
Lines 1672-1678 force_paren_expr (tree expr) Link Here
1672
      if ((kind & ~clk_class) != clk_none)
1655
      if ((kind & ~clk_class) != clk_none)
1673
	{
1656
	{
1674
	  tree type = unlowered_expr_type (expr);
1657
	  tree type = unlowered_expr_type (expr);
1675
	  bool rval = !!(kind & clk_rvalueref);
1658
	  bool rval = (kind & clk_rvalueref);
1676
	  type = cp_build_reference_type (type, rval);
1659
	  type = cp_build_reference_type (type, rval);
1677
	  /* This inhibits warnings in, eg, cxx_mark_addressable
1660
	  /* This inhibits warnings in, eg, cxx_mark_addressable
1678
	     (c++/60955).  */
1661
	     (c++/60955).  */
Lines 1682-1691 force_paren_expr (tree expr) Link Here
1682
	    REF_PARENTHESIZED_P (expr) = true;
1665
	    REF_PARENTHESIZED_P (expr) = true;
1683
	}
1666
	}
1684
    }
1667
    }
1685
1686
  return expr;
1687
}
1668
}
1688
1689
/* Finish a parenthesized expression EXPR.  */
1669
/* Finish a parenthesized expression EXPR.  */
1690
1670
1691
tree
1671
tree
Lines 1704-1711 finish_parenthesized_expr (tree expr) Link Here
1704
  if (TREE_CODE (expr) == STRING_CST)
1684
  if (TREE_CODE (expr) == STRING_CST)
1705
    PAREN_STRING_LITERAL_P (expr) = 1;
1685
    PAREN_STRING_LITERAL_P (expr) = 1;
1706
1686
1707
  expr = force_paren_expr (expr);
1708
1709
  return expr;
1687
  return expr;
1710
}
1688
}
1711
1689
Lines 7369-7375 finish_decltype_type (tree expr, bool id_expression_or_member_access_p, Link Here
7369
	    type = strip_typedefs (type);
7347
	    type = strip_typedefs (type);
7370
7348
7371
	  if (clk != clk_none && !(clk & clk_class))
7349
	  if (clk != clk_none && !(clk & clk_class))
7350
          {
7351
	    check_paren_expr(expr);
7372
	    type = cp_build_reference_type (type, (clk & clk_rvalueref));
7352
	    type = cp_build_reference_type (type, (clk & clk_rvalueref));
7353
          }
7373
	}
7354
	}
7374
    }
7355
    }
7375
7356

Return to bug 67064