diff options
| author | zooster <r00ster91@proton.me> | 2023-06-27 19:22:47 -0400 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-06-28 14:00:18 +0300 |
| commit | 28f515acd7bb6e008fcb2e9f760053f0c9e97992 (patch) | |
| tree | da395a3bf718d18b319526e9956345f264eb1197 /test | |
| parent | 910ad92e0e74fd1e9e7407130823d7ad299b5ea6 (diff) | |
| download | zig-28f515acd7bb6e008fcb2e9f760053f0c9e97992.tar.gz zig-28f515acd7bb6e008fcb2e9f760053f0c9e97992.zip | |
behavior: test slicing array of zero-sized values
Closes #15343
Diffstat (limited to 'test')
| -rw-r--r-- | test/behavior/array.zig | 13 |
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); +} |
