+2019-01-11 Jason Merrill <jason@redhat.com>
+
+ PR c++/88613 - ICE with use of const var in lambda.
+ * expr.c (mark_use): Fix location wrapper handling.
+ * cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
+
2019-01-11 Tobias Burnus <burnus@net-b.de>
PR C++/88114
}
break;
- CASE_CONVERT:
case VIEW_CONVERT_EXPR:
if (location_wrapper_p (expr))
- loc = EXPR_LOCATION (expr);
+ {
+ loc = EXPR_LOCATION (expr);
+ tree op = TREE_OPERAND (expr, 0);
+ tree nop = RECUR (op);
+ if (nop == error_mark_node)
+ return error_mark_node;
+ TREE_OPERAND (expr, 0) = nop;
+ /* If we're replacing a DECL with a constant, we also need to change
+ the TREE_CODE of the location wrapper. */
+ if (op != nop && rvalue_p)
+ TREE_SET_CODE (expr, NON_LVALUE_EXPR);
+ return expr;
+ }
+ gcc_fallthrough();
+ CASE_CONVERT:
recurse_op[0] = true;
break;