| ... | ... | @@ -2845,8 +2845,20 @@ static TypeTableEntry *analyze_bool_bin_op_expr(CodeGen *g, ImportTableEntry *im |
| 2845 | 2845 | TypeTableEntry *resolved_type = resolve_peer_type_compatibility(g, import, context, node, |
| 2846 | 2846 | op_nodes, op_types, 2); |
| 2847 | 2847 | |
| 2848 | bool type_can_gt_lt_cmp = (resolved_type->id == TypeTableEntryIdNumLitFloat || |
| 2849 | resolved_type->id == TypeTableEntryIdNumLitInt || |
| 2850 | resolved_type->id == TypeTableEntryIdFloat || |
| 2851 | resolved_type->id == TypeTableEntryIdInt); |
| 2852 | |
| 2848 | 2853 | if (resolved_type->id == TypeTableEntryIdInvalid) { |
| 2849 | 2854 | return g->builtin_types.entry_invalid; |
| 2855 | } else if (bin_op_type != BinOpTypeCmpEq && |
| 2856 | bin_op_type != BinOpTypeCmpNotEq && |
| 2857 | !type_can_gt_lt_cmp) |
| 2858 | { |
| 2859 | add_node_error(g, node, |
| 2860 | buf_sprintf("operator not allowed for type '%s'", buf_ptr(&resolved_type->name))); |
| 2861 | return g->builtin_types.entry_invalid; |
| 2850 | 2862 | } |
| 2851 | 2863 | |
| 2852 | 2864 | ConstExprValue *op1_val = &get_resolved_expr(op1)->const_val; |
| ... | ... | @@ -2856,11 +2868,7 @@ static TypeTableEntry *analyze_bool_bin_op_expr(CodeGen *g, ImportTableEntry *im |
| 2856 | 2868 | } |
| 2857 | 2869 | |
| 2858 | 2870 | bool answer; |
| 2859 | | if (resolved_type->id == TypeTableEntryIdNumLitFloat || |
| 2860 | | resolved_type->id == TypeTableEntryIdNumLitInt || |
| 2861 | | resolved_type->id == TypeTableEntryIdFloat || |
| 2862 | | resolved_type->id == TypeTableEntryIdInt) |
| 2863 | | { |
| 2871 | if (type_can_gt_lt_cmp) { |
| 2864 | 2872 | bool (*bignum_cmp)(BigNum *, BigNum *); |
| 2865 | 2873 | if (bin_op_type == BinOpTypeCmpEq) { |
| 2866 | 2874 | bignum_cmp = bignum_cmp_eq; |