authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-02-19 17:58:27-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-02-19 21:18:27-07:00
loge778e4714006a78814dc09c66713073ab2f05515
tree8f426227a09f60029f46a980b0097e430b28943c
parent680d79ebf9591be74790999088c882de50a2863b

add test coverage for fixed bug. closes #5516


1 files changed, 9 insertions(+), 0 deletions(-)

test/behavior/cast.zig+9
......@@ -1568,3 +1568,12 @@ test "@volatileCast without a result location" {
15681568 try expect(@TypeOf(z) == *i32);
15691569 try expect(z.* == 1234);
15701570}
1571
1572test "coercion from single-item pointer to @as to slice" {
1573 var x: u32 = 1;
1574
1575 // Why the following line gets a compile error?
1576 const t: []u32 = @as(*[1]u32, &x);
1577
1578 try expect(t[0] == 1);
1579}