Commit 6960cd156a

Jimmi Holst Christensen <jimmi@ziglang.org>
2019-04-07 03:18:51
Added regression test for #1607. fixes #1607
1 parent f00adb4
Changed files (1)
test
stage1
behavior
test/stage1/behavior/bugs/1607.zig
@@ -0,0 +1,15 @@
+const std = @import("std");
+const testing = std.testing;
+
+const a = []u8{1,2,3};
+
+fn checkAddress(s: []const u8) void {
+    for (s) |*i, j| {
+        testing.expect(i == &a[j]);
+    }
+}
+
+test "slices pointing at the same address as global array." {
+    checkAddress(a);
+    comptime checkAddress(a);
+}
\ No newline at end of file