| ... | @@ -1568,3 +1568,12 @@ test "@volatileCast without a result location" { | ... | @@ -1568,3 +1568,12 @@ test "@volatileCast without a result location" { |
| 1568 | try expect(@TypeOf(z) == *i32); | 1568 | try expect(@TypeOf(z) == *i32); |
| 1569 | try expect(z.* == 1234); | 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 | } |