behavior: test slicing array of zero-sized values

Closes #15343
This commit is contained in:
zooster 2023-06-27 19:22:47 -04:00 committed by Veikka Tuominen
parent 910ad92e0e
commit 28f515acd7

View File

@ -748,3 +748,16 @@ test "array init with no result location has result type" {
try expect(x.foo[0] == 10);
try expect(x.foo[1] == 20);
}
test "slicing array of zero-sized values" {
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
var arr: [32]u0 = undefined;
for (arr[0..]) |*zero|
zero.* = 0;
for (arr[0..]) |zero|
try expect(zero == 0);
}