fix @intCast not catching negative numbers to unsigned

This commit is contained in:
Andrew Kelley
2018-11-24 14:36:16 -05:00
parent b953e322a8
commit 56a8f2b018
3 changed files with 67 additions and 48 deletions

View File

@@ -1645,7 +1645,7 @@ static LLVMValueRef gen_widen_or_shorten(CodeGen *g, bool want_runtime_safety, Z
zig_unreachable();
}
if (actual_bits >= wanted_bits && actual_type->id == ZigTypeIdInt &&
if (actual_type->id == ZigTypeIdInt &&
!wanted_type->data.integral.is_signed && actual_type->data.integral.is_signed &&
want_runtime_safety)
{