aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJimmi Holst Christensen <jimmi@ziglang.org>2019-04-07 03:18:51 +0200
committerJimmi Holst Christensen <jimmi@ziglang.org>2019-04-07 03:18:51 +0200
commit6960cd156addc23492ddbb3c1b7627a63d2ba46a (patch)
tree9a5dc521310c1bb951b43ca3d6659c1a98a758fb /test
parentf00adb47f5c2b70496dac1c48f03236271b9bd57 (diff)
downloadzig-6960cd156addc23492ddbb3c1b7627a63d2ba46a.tar.gz
zig-6960cd156addc23492ddbb3c1b7627a63d2ba46a.zip
Added regression test for #1607. fixes #1607
Diffstat (limited to 'test')
-rw-r--r--test/stage1/behavior/bugs/1607.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/stage1/behavior/bugs/1607.zig b/test/stage1/behavior/bugs/1607.zig
new file mode 100644
index 0000000000..04c894a35e
--- /dev/null
+++ b/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