| author | |
| committer | |
| log | 6960cd156addc23492ddbb3c1b7627a63d2ba46a |
| tree | 9a5dc521310c1bb951b43ca3d6659c1a98a758fb |
| parent | f00adb47f5c2b70496dac1c48f03236271b9bd57 |
1 files changed, 15 insertions(+), 0 deletions(-)
test/stage1/behavior/bugs/1607.zig created+15| ... | @@ -0,0 +1,15 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const testing = std.testing; | ||
| 3 | |||
| 4 | const a = []u8{1,2,3}; | ||
| 5 | |||
| 6 | fn checkAddress(s: []const u8) void { | ||
| 7 | for (s) |*i, j| { | ||
| 8 | testing.expect(i == &a[j]); | ||
| 9 | } | ||
| 10 | } | ||
| 11 | |||
| 12 | test "slices pointing at the same address as global array." { | ||
| 13 | checkAddress(a); | ||
| 14 | comptime checkAddress(a); | ||
| 15 | } | ||
| \ No newline at end of file | |||