summaryrefslogtreecommitdiff
path: root/gcc/cp/typeck.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/typeck.c')
-rw-r--r--gcc/cp/typeck.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 90a1f47e3fd..08b2ae555e6 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5654,6 +5654,9 @@ cp_build_addr_expr_1 (tree arg, bool strict_lvalue, tsubst_flags_t complain)
return error_mark_node;
arg = mark_lvalue_use (arg);
+ if (error_operand_p (arg))
+ return error_mark_node;
+
argtype = lvalue_type (arg);
gcc_assert (!(identifier_p (arg) && IDENTIFIER_ANY_OP_P (arg)));
@@ -7059,11 +7062,7 @@ build_static_cast (tree type, tree oexpr, tsubst_flags_t complain)
if (dependent)
{
tmpl:
- expr = oexpr;
- if (dependent)
- /* Handle generic lambda capture. */
- expr = mark_lvalue_use (expr);
- expr = build_min (STATIC_CAST_EXPR, type, expr);
+ expr = build_min (STATIC_CAST_EXPR, type, oexpr);
/* We don't know if it will or will not have side effects. */
TREE_SIDE_EFFECTS (expr) = 1;
return convert_from_reference (expr);
@@ -7702,6 +7701,8 @@ tree
cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
tree rhs, tsubst_flags_t complain)
{
+ lhs = mark_lvalue_use_nonread (lhs);
+
tree result = NULL_TREE;
tree newrhs = rhs;
tree lhstype = TREE_TYPE (lhs);
@@ -7924,6 +7925,8 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
operator. -- end note ] */
lhs = cp_stabilize_reference (lhs);
rhs = rvalue (rhs);
+ if (rhs == error_mark_node)
+ return error_mark_node;
rhs = stabilize_expr (rhs, &init);
newrhs = cp_build_binary_op (loc, modifycode, lhs, rhs, complain);
if (newrhs == error_mark_node)
@@ -9109,7 +9112,7 @@ check_return_expr (tree retval, bool *no_warning)
dependent:
/* We should not have changed the return value. */
gcc_assert (retval == saved_retval);
- return retval;
+ return do_dependent_capture (retval, /*force*/true);
}
/* The fabled Named Return Value optimization, as per [class.copy]/15: