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.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index 5df005e648..812484b463 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -1395,6 +1395,17 @@ fn something() -> %void { }
pub fn main(args: [][]u8) { }
)SOURCE", 1, ".tmp_source.zig:2:27: error: expected return type of main to be '%void', instead is 'void'");
+
+ add_compile_fail_case("invalid pointer for var type", R"SOURCE(
+extern fn ext() -> isize;
+var bytes: [ext()]u8 = undefined;
+fn f() {
+ for (bytes) |*b, i| {
+ *b = u8(i);
+ }
+}
+ )SOURCE", 1, ".tmp_source.zig:3:13: error: unable to evaluate constant expression");
+
}
//////////////////////////////////////////////////////////////////////////////