aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-11-26 23:07:47 +0100
committerAndrew Kelley <andrew@ziglang.org>2020-11-27 14:33:26 -0800
commitf91df39ad2a54bc5367ba562ca703e564dd4a38d (patch)
tree490b5ee62acd2c0ba3708510f4cda30d6efab020 /test
parent3bc1c719bd632e6baccb574bf75cb93f0bdef08f (diff)
downloadzig-f91df39ad2a54bc5367ba562ca703e564dd4a38d.tar.gz
zig-f91df39ad2a54bc5367ba562ca703e564dd4a38d.zip
stage1: Fix crash in *[N]T to []T conversion with zst
Prevent the crash by not making the codegen try to access the non-existing ptr field in the slice. Closes #6951
Diffstat (limited to 'test')
-rw-r--r--test/stage1/behavior/cast.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/stage1/behavior/cast.zig b/test/stage1/behavior/cast.zig
index d39b20a7e1..6d1e8c29ab 100644
--- a/test/stage1/behavior/cast.zig
+++ b/test/stage1/behavior/cast.zig
@@ -908,3 +908,9 @@ test "cast from ?[*]T to ??[*]T" {
const a: ??[*]u8 = @as(?[*]u8, null);
expect(a != null and a.? == null);
}
+
+test "cast between *[N]void and []void" {
+ var a: [4]void = undefined;
+ var b: []void = &a;
+ expect(b.len == 4);
+}