aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-05-16 22:51:08 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-05-16 22:51:08 -0700
commit2c710382a888e8f45b958bdf3e77213cc18c2733 (patch)
treed6933afbfeb9d50434fb1bc5c0743c4e1a083e34 /test/run_tests.cpp
parent3df9389215b365a83b1a509e55086595105c1f58 (diff)
downloadzig-2c710382a888e8f45b958bdf3e77213cc18c2733.tar.gz
zig-2c710382a888e8f45b958bdf3e77213cc18c2733.zip
fix crash when error evaluating target of for expr
closes #153
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");
+
}
//////////////////////////////////////////////////////////////////////////////