diff --git a/src/aro/Value.zig b/src/aro/Value.zig index 6d246038..b178e810 100644 --- a/src/aro/Value.zig +++ b/src/aro/Value.zig @@ -143,7 +143,7 @@ pub fn floatToInt(v: *Value, dest_ty: Type, comp: *Compilation) !FloatToIntChang v.* = fromBool(!was_zero); if (was_zero or was_one) return .none; return .value_changed; - } else if (dest_ty.isUnsignedInt(comp) and v.compare(.lt, zero, comp)) { + } else if (dest_ty.isUnsignedInt(comp) and float_val < 0) { v.* = zero; return .out_of_range; } diff --git a/test/cases/complex values.c b/test/cases/complex values.c index bb535fad..43bdc7b9 100644 --- a/test/cases/complex values.c +++ b/test/cases/complex values.c @@ -33,6 +33,7 @@ _Complex double c = (_Complex double) {1.0, 2.0,3.0}; _Static_assert(3 + 4.0il == 3 + 4.0il, ""); _Static_assert(5ll + 4.0il == 5ll + 4.0il, ""); +unsigned long complex_integer = 2.0i; #define EXPECTED_ERRORS "complex values.c:31:49: error: expected expression" \ "complex values.c:32:49: warning: excess elements in scalar initializer [-Wexcess-initializers]" \