From e778e4714006a78814dc09c66713073ab2f05515 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 19 Feb 2023 17:58:27 -0700 Subject: [PATCH] add test coverage for fixed bug. closes #5516 --- test/behavior/cast.zig | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/behavior/cast.zig b/test/behavior/cast.zig index 16f3c6e2dd..927caa965b 100644 --- a/test/behavior/cast.zig +++ b/test/behavior/cast.zig @@ -1568,3 +1568,12 @@ test "@volatileCast without a result location" { try expect(@TypeOf(z) == *i32); try expect(z.* == 1234); } + +test "coercion from single-item pointer to @as to slice" { + var x: u32 = 1; + + // Why the following line gets a compile error? + const t: []u32 = @as(*[1]u32, &x); + + try expect(t[0] == 1); +}