aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/array.zig
diff options
context:
space:
mode:
authorzooster <r00ster91@proton.me>2023-06-27 19:22:47 -0400
committerVeikka Tuominen <git@vexu.eu>2023-06-28 14:00:18 +0300
commit28f515acd7bb6e008fcb2e9f760053f0c9e97992 (patch)
treeda395a3bf718d18b319526e9956345f264eb1197 /test/behavior/array.zig
parent910ad92e0e74fd1e9e7407130823d7ad299b5ea6 (diff)
downloadzig-28f515acd7bb6e008fcb2e9f760053f0c9e97992.tar.gz
zig-28f515acd7bb6e008fcb2e9f760053f0c9e97992.zip
behavior: test slicing array of zero-sized values
Closes #15343
Diffstat (limited to 'test/behavior/array.zig')
-rw-r--r--test/behavior/array.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/behavior/array.zig b/test/behavior/array.zig
index 82313cddc7..5d475c9b25 100644
--- a/test/behavior/array.zig
+++ b/test/behavior/array.zig
@@ -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);
+}