|
| 1 | +export fn bigger(a: *const [10]u32) void { |
| 2 | + const b: *const [20]u32 = a; |
| 3 | + _ = b; |
| 4 | +} |
| 5 | + |
| 6 | +comptime { |
| 7 | + const a: *const [10]u32 = &@splat(0); |
| 8 | + const b: *const [20]u32 = a; |
| 9 | + _ = b; |
| 10 | +} |
| 11 | + |
| 12 | +export fn biggerSentinel(a: *const [10:0]u32) void { |
| 13 | + const b: *const [20]u32 = a; |
| 14 | + _ = b; |
| 15 | +} |
| 16 | + |
| 17 | +comptime { |
| 18 | + const a: *const [10:0]u32 = &@splat(0); |
| 19 | + const b: *const [20]u32 = a; |
| 20 | + _ = b; |
| 21 | +} |
| 22 | + |
| 23 | +export fn smaller(a: *const [10]u32) void { |
| 24 | + const b: *const [5]u32 = a; |
| 25 | + _ = b; |
| 26 | +} |
| 27 | + |
| 28 | +comptime { |
| 29 | + const a: *const [10]u32 = &@splat(0); |
| 30 | + const b: *const [5]u32 = a; |
| 31 | + _ = b; |
| 32 | +} |
| 33 | + |
| 34 | +export fn smallerSentinel(a: *const [10:0]u32) void { |
| 35 | + const b: *const [5]u32 = a; |
| 36 | + _ = b; |
| 37 | +} |
| 38 | + |
| 39 | +comptime { |
| 40 | + const a: *const [10:0]u32 = &@splat(0); |
| 41 | + const b: *const [5]u32 = a; |
| 42 | + _ = b; |
| 43 | +} |
| 44 | + |
| 45 | +// error |
| 46 | +// |
| 47 | +// :2:31: error: expected type '*const [20]u32', found '*const [10]u32' |
| 48 | +// :2:31: note: pointer type child '[10]u32' cannot cast into pointer type child '[20]u32' |
| 49 | +// :2:31: note: array of length 10 cannot cast into an array of length 20 |
| 50 | +// :8:31: error: expected type '*const [20]u32', found '*const [10]u32' |
| 51 | +// :8:31: note: pointer type child '[10]u32' cannot cast into pointer type child '[20]u32' |
| 52 | +// :8:31: note: array of length 10 cannot cast into an array of length 20 |
| 53 | +// :13:31: error: expected type '*const [20]u32', found '*const [10:0]u32' |
| 54 | +// :13:31: note: pointer type child '[10:0]u32' cannot cast into pointer type child '[20]u32' |
| 55 | +// :13:31: note: array of length 10 cannot cast into an array of length 20 |
| 56 | +// :19:31: error: expected type '*const [20]u32', found '*const [10:0]u32' |
| 57 | +// :19:31: note: pointer type child '[10:0]u32' cannot cast into pointer type child '[20]u32' |
| 58 | +// :19:31: note: array of length 10 cannot cast into an array of length 20 |
| 59 | +// :24:30: error: expected type '*const [5]u32', found '*const [10]u32' |
| 60 | +// :24:30: note: pointer type child '[10]u32' cannot cast into pointer type child '[5]u32' |
| 61 | +// :24:30: note: array of length 10 cannot cast into an array of length 5 |
| 62 | +// :30:30: error: expected type '*const [5]u32', found '*const [10]u32' |
| 63 | +// :30:30: note: pointer type child '[10]u32' cannot cast into pointer type child '[5]u32' |
| 64 | +// :30:30: note: array of length 10 cannot cast into an array of length 5 |
| 65 | +// :35:30: error: expected type '*const [5]u32', found '*const [10:0]u32' |
| 66 | +// :35:30: note: pointer type child '[10:0]u32' cannot cast into pointer type child '[5]u32' |
| 67 | +// :35:30: note: array of length 10 cannot cast into an array of length 5 |
| 68 | +// :41:30: error: expected type '*const [5]u32', found '*const [10:0]u32' |
| 69 | +// :41:30: note: pointer type child '[10:0]u32' cannot cast into pointer type child '[5]u32' |
| 70 | +// :41:30: note: array of length 10 cannot cast into an array of length 5 |
0 commit comments