diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-11-18 16:44:12 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-18 16:44:12 -0800 |
| commit | fbcb00fbb38715cede40fb4af6b6f99b771ff02a (patch) | |
| tree | 53709862fe67e2eba89bb08da1866391d11db3a0 /test | |
| parent | e6d2e1641363c97f53d4168b319b4dca6224e25e (diff) | |
| parent | 41282e7fb2874c3c838e2b00761d6e8b174a7beb (diff) | |
| download | zig-fbcb00fbb38715cede40fb4af6b6f99b771ff02a.tar.gz zig-fbcb00fbb38715cede40fb4af6b6f99b771ff02a.zip | |
Merge pull request #22004 from jacobly0/fix-self-llvm
fix llvm-enabled compiler builds with the self-hosted backend
Diffstat (limited to 'test')
| -rw-r--r-- | test/behavior/slice.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/behavior/slice.zig b/test/behavior/slice.zig index 15db19f1e8..4f5367ad85 100644 --- a/test/behavior/slice.zig +++ b/test/behavior/slice.zig @@ -995,3 +995,11 @@ test "sentinel-terminated 0-length slices" { try expect(comptime_known_array_value[0] == 2); try expect(runtime_array_value[0] == 2); } + +test "peer slices keep abi alignment with empty struct" { + var cond: bool = undefined; + cond = false; + const slice = if (cond) &[1]u32{42} else &.{}; + comptime assert(@TypeOf(slice) == []const u32); + try expect(slice.len == 0); +} |
