From 6a820c2845fbc4fcc158da40acce0468e911866d Mon Sep 17 00:00:00 2001 From: playX Date: Thu, 7 Apr 2022 13:22:24 +0400 Subject: [PATCH] checker: allow all binary operations when translating code produced by c2v (#13964) --- vlib/v/checker/checker.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index fcd25b455a..357e7b6c5e 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -576,8 +576,8 @@ pub fn (mut c Checker) infix_expr(mut node ast.InfixExpr) ast.Type { left_right_pos := left_pos.extend(right_pos) if left_type.is_any_kind_of_pointer() && node.op in [.plus, .minus, .mul, .div, .mod, .xor, .amp, .pipe] { - if (right_type.is_any_kind_of_pointer() && node.op != .minus) - || (!right_type.is_any_kind_of_pointer() && node.op !in [.plus, .minus]) { + if !c.pref.translated && ((right_type.is_any_kind_of_pointer() && node.op != .minus) + || (!right_type.is_any_kind_of_pointer() && node.op !in [.plus, .minus])) { left_name := c.table.type_to_str(left_type) right_name := c.table.type_to_str(right_type) c.error('invalid operator `$node.op` to `$left_name` and `$right_name`', left_right_pos)