aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-08-25 10:39:19 +0100
committergingerBill <bill@gingerbill.org>2018-08-25 10:39:19 +0100
commitf050bfe8722f8470181975853c5ad6ea2b99fb6f (patch)
treee21804c26e785851f46ae4b999b40c93d39c72c6 /src/check_expr.cpp
parentab71acc3a5f6a82fbfb610e18b510f9b980adde8 (diff)
Fix comparisons with union
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 863e0892b..60d31c70c 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -1531,7 +1531,7 @@ void check_comparison(CheckerContext *c, Operand *x, Operand *y, TokenKind op) {
switch (op) {
case Token_CmpEq:
case Token_NotEq:
- defined = is_type_comparable(x->type) ||
+ defined = (is_type_comparable(x->type) && is_type_comparable(y->type)) ||
(is_operand_nil(*x) && type_has_nil(y->type)) ||
(is_operand_nil(*y) && type_has_nil(x->type));
break;
@@ -1539,7 +1539,7 @@ void check_comparison(CheckerContext *c, Operand *x, Operand *y, TokenKind op) {
case Token_Gt:
case Token_LtEq:
case Token_GtEq:
- defined = is_type_ordered(x->type);
+ defined = is_type_ordered(x->type) && is_type_ordered(y->type);
break;
}