2018-02-19 Jakub Jelinek <jakub@redhat.com>
+ PR c++/84448
+ * parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if
+ either operand is error_mark_node, set current.lhs to that instead of
+ creating a binary op with error_mark_node operands.
+
PR c++/84430
* constexpr.c (potential_constant_expression_1): Handle OMP_SIMD.
&& lookahead_prec <= current.prec
&& sp == stack)
{
- current.lhs
- = build_min (current.tree_type,
- TREE_CODE_CLASS (current.tree_type) == tcc_comparison
- ? boolean_type_node : TREE_TYPE (current.lhs),
- current.lhs.get_value (), rhs.get_value ());
- SET_EXPR_LOCATION (current.lhs, combined_loc);
+ if (current.lhs == error_mark_node || rhs == error_mark_node)
+ current.lhs = error_mark_node;
+ else
+ {
+ current.lhs
+ = build_min (current.tree_type,
+ TREE_CODE_CLASS (current.tree_type)
+ == tcc_comparison
+ ? boolean_type_node : TREE_TYPE (current.lhs),
+ current.lhs.get_value (), rhs.get_value ());
+ SET_EXPR_LOCATION (current.lhs, combined_loc);
+ }
}
else
{