zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 6960cd156addc23492ddbb3c1b7627a63d2ba46a (tree)
parent f00adb47f5c2b70496dac1c48f03236271b9bd57
Author: Jimmi Holst Christensen <jimmi@ziglang.org>
Date:   Sun,  7 Apr 2019 03:18:51 +0200

Added regression test for #1607. fixes #1607

Diffstat:
Atest/stage1/behavior/bugs/1607.zig | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/test/stage1/behavior/bugs/1607.zig 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