From 6960cd156addc23492ddbb3c1b7627a63d2ba46a Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Sun, 7 Apr 2019 03:18:51 +0200 Subject: [PATCH] Added regression test for #1607. fixes #1607 --- test/stage1/behavior/bugs/1607.zig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/stage1/behavior/bugs/1607.zig 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