blob: 47af7a350a04bfb0c73e068f1fdbe598adc43e8d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
const std = @import("std");
const builtin = @import("builtin");
const testing = std.testing;
test "slicing zero length array field of struct" {
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
const S = struct {
a: [0]usize,
fn foo(self: *@This(), start: usize, end: usize) []usize {
return self.a[start..end];
}
};
var s: S = undefined;
try testing.expect(s.foo(0, 0).len == 0);
}
|