fix assertion fail when using global var number literal

closes #697
This commit is contained in:
Andrew Kelley
2018-01-31 11:13:39 -05:00
parent 40ca39d3d5
commit 44f38b04b0
2 changed files with 11 additions and 0 deletions

View File

@@ -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,