@@ -9330,12 +9330,14 @@ cp_parser_binary_expression (cp_parser*
if (no_toplevel_fold_p
&& lookahead_prec <= current.prec
&& sp == stack)
- current.lhs = build2_loc (combined_loc,
- current.tree_type,
- TREE_CODE_CLASS (current.tree_type)
- == tcc_comparison
- ? boolean_type_node : TREE_TYPE (current.lhs),
- current.lhs, rhs);
+ {
+ 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
{
current.lhs = build_x_binary_op (combined_loc, current.tree_type,
@@ -0,0 +1,10 @@
+/* PR c++/84341 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void
+foo (int i)
+{
+ #pragma omp atomic
+ i = &i + 1; /* { dg-error "invalid form of" } */
+}