diff options
| -rw-r--r-- | test/stage1/behavior/bugs/1607.zig | 15 |
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 |
