aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-01-31 11:13:39 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-01-31 11:13:39 -0500
commit44f38b04b0cc374fcd377df0fe68f29c824185ff (patch)
tree4d3302eeb87b768a8d1d0b78eaebc54daf077f2e /test
parent40ca39d3d5a556e3b5d7298e3a5182f4351bdd17 (diff)
downloadzig-44f38b04b0cc374fcd377df0fe68f29c824185ff.tar.gz
zig-44f38b04b0cc374fcd377df0fe68f29c824185ff.zip
fix assertion fail when using global var number literal
closes #697
Diffstat (limited to 'test')
-rw-r--r--test/compile_errors.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 223646e767..3267ea7435 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -1,6 +1,13 @@
const tests = @import("tests.zig");
pub fn addCases(cases: &tests.CompileErrorContext) void {
+ cases.add("use invalid number literal as array index",
+ \\var v = 25;
+ \\export fn entry() void {
+ \\ var arr: [v]u8 = undefined;
+ \\}
+ , ".tmp_source.zig:1:1: error: unable to infer variable type");
+
cases.add("duplicate struct field",
\\const Foo = struct {
\\ Bar: i32,