diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-09-13 11:31:17 +0100 |
|---|---|---|
| committer | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-09-13 17:13:27 +0100 |
| commit | 32a1aabff78234b428234189ee1093fb65f85fa3 (patch) | |
| tree | 6a619405decf6d9334ca0b735642e9ef5fd2338d /test/behavior/enum.zig | |
| parent | a0ec4e270e680960290642468f6df3ce7e7d7664 (diff) | |
| download | zig-32a1aabff78234b428234189ee1093fb65f85fa3.tar.gz zig-32a1aabff78234b428234189ee1093fb65f85fa3.zip | |
std.math.big.int: normalize zero result for small multiplications
Resolves: #25221
Diffstat (limited to 'test/behavior/enum.zig')
| -rw-r--r-- | test/behavior/enum.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/behavior/enum.zig b/test/behavior/enum.zig index d719a611e6..269fba13ba 100644 --- a/test/behavior/enum.zig +++ b/test/behavior/enum.zig @@ -1325,3 +1325,10 @@ test "large enum field values" { try expect(@intFromEnum(e) == std.math.maxInt(i128)); } } + +test "comptime @enumFromInt with signed arithmetic" { + const E = enum(i8) { foo = -1, bar = 0 }; + const x: E = @enumFromInt(@as(i8, -1) * 0); + comptime assert(x == .bar); + comptime assert(@intFromEnum(x) == 0); +} |
