authorgravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2023-06-27 19:22:47-04:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-06-28 14:00:18+03:00
log28f515acd7bb6e008fcb2e9f760053f0c9e97992
treeda395a3bf718d18b319526e9956345f264eb1197
parent910ad92e0e74fd1e9e7407130823d7ad299b5ea6

behavior: test slicing array of zero-sized values

Closes #15343

1 files changed, 13 insertions(+), 0 deletions(-)

test/behavior/array.zig+13
...@@ -748,3 +748,16 @@ test "array init with no result location has result type" {...@@ -748,3 +748,16 @@ test "array init with no result location has result type" {
748 try expect(x.foo[0] == 10);748 try expect(x.foo[0] == 10);
749 try expect(x.foo[1] == 20);749 try expect(x.foo[1] == 20);
750}750}
751
752test "slicing array of zero-sized values" {
753 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
754 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
755 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;
756 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
757
758 var arr: [32]u0 = undefined;
759 for (arr[0..]) |*zero|
760 zero.* = 0;
761 for (arr[0..]) |zero|
762 try expect(zero == 0);
763}