aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorVexu <git@vexu.eu>2020-05-12 01:25:24 +0300
committerGitHub <noreply@github.com>2020-05-12 01:25:24 +0300
commit7aee8a93ebc199dd5ff94387f0906699d795c138 (patch)
tree2a500c59212998b0dfb0671cf8f8556f9de0f558 /test/compile_errors.zig
parent3e3c651b670fb45e714db1cfb32428c3ea3cd828 (diff)
parent204f8daeeda02738479e0d586e6426e23f78e6cc (diff)
downloadzig-7aee8a93ebc199dd5ff94387f0906699d795c138.tar.gz
zig-7aee8a93ebc199dd5ff94387f0906699d795c138.zip
Merge pull request #5315 from xackus/fix-bigint_fits_in_bits
stage1: detect underflow in bigint_fits_in_bits
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 5eb009dafa..a6e2d0b98f 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -7411,4 +7411,12 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
, &[_][]const u8{
":5:28: error: expected type '[]u8', found '*const [3:0]u8'",
});
+
+ cases.add("integer underflow error",
+ \\export fn entry() void {
+ \\ _ = @intToPtr(*c_void, ~@as(usize, @import("std").math.maxInt(usize)) - 1);
+ \\}
+ , &[_][]const u8{
+ ":2:75: error: operation caused overflow",
+ });
}