aboutsummaryrefslogtreecommitdiff
path: root/lib/std/fmt.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-03-19 18:06:16 -0400
committerGitHub <noreply@github.com>2020-03-19 18:06:16 -0400
commitdc04e97098010f590d109e6e70d4afe79cd8f01b (patch)
treebed11818fd80fe7b4557f4253c8d5562de773624 /lib/std/fmt.zig
parent555a2c03286507ffe4bd3bea2154dbfb719ebef1 (diff)
parent160367e0ddcb36b6957e603d869507b9d7542edc (diff)
downloadzig-dc04e97098010f590d109e6e70d4afe79cd8f01b.tar.gz
zig-dc04e97098010f590d109e6e70d4afe79cd8f01b.zip
Merge pull request #4752 from ziglang/slice-array
slicing with comptime start and end indexes results in pointer-to-array
Diffstat (limited to 'lib/std/fmt.zig')
-rw-r--r--lib/std/fmt.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig
index 592fe9bb4e..7fc9961938 100644
--- a/lib/std/fmt.zig
+++ b/lib/std/fmt.zig
@@ -1223,7 +1223,8 @@ test "slice" {
try testFmt("slice: abc\n", "slice: {}\n", .{value});
}
{
- const value = @intToPtr([*]align(1) const []const u8, 0xdeadbeef)[0..0];
+ var runtime_zero: usize = 0;
+ const value = @intToPtr([*]align(1) const []const u8, 0xdeadbeef)[runtime_zero..runtime_zero];
try testFmt("slice: []const u8@deadbeef\n", "slice: {}\n", .{value});
}