| author | |
| committer | |
| log | e778e4714006a78814dc09c66713073ab2f05515 |
| tree | 8f426227a09f60029f46a980b0097e430b28943c |
| parent | 680d79ebf9591be74790999088c882de50a2863b |
1 files changed, 9 insertions(+), 0 deletions(-)
test/behavior/cast.zig+9| ... | ... | @@ -1568,3 +1568,12 @@ test "@volatileCast without a result location" { |
| 1568 | 1568 | try expect(@TypeOf(z) == *i32); |
| 1569 | 1569 | try expect(z.* == 1234); |
| 1570 | 1570 | } |
| 1571 | ||
| 1572 | test "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 | } |