aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index f9f5707bca..5b3d68e72b 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -1481,6 +1481,16 @@ fn foo() {
const pointer = &array[0];
}
)SOURCE", 1, ".tmp_source.zig:4:27: error: out of bounds array access");
+
+ add_compile_fail_case("compile time division by zero", R"SOURCE(
+const x = foo(0);
+fn foo(x: i32) -> i32 {
+ 1 / x
+}
+ )SOURCE", 3,
+ ".tmp_source.zig:3:1: error: function evaluation caused division by zero",
+ ".tmp_source.zig:2:14: note: called from here",
+ ".tmp_source.zig:4:7: note: division by zero here");
}
//////////////////////////////////////////////////////////////////////////////