| 1 | const p: ?*const u8 = null; |
| 2 | export fn a() void { |
| 3 | _ = @as(*const u32, @ptrCast(@alignCast(p))); |
| 4 | } |
| 5 | export fn b() void { |
| 6 | _ = @constCast(@volatileCast(123)); |
| 7 | } |
| 8 | export fn c() void { |
| 9 | const x: ?*f32 = @ptrCast(@addrSpaceCast(@constCast(@volatileCast(p)))); |
| 10 | _ = x; |
| 11 | } |
| 12 | |
| 13 | // error |
| 14 | // |
| 15 | // :3:45: error: null pointer casted to type '*const u32' |
| 16 | // :6:34: error: expected pointer type, found 'comptime_int' |
| 17 | // :9:22: error: @ptrCast increases pointer alignment |
| 18 | // :9:71: note: '?*const u8' has alignment '1' |
| 19 | // :9:22: note: '?*f32' has alignment '4' |
| 20 | // :9:22: note: use @alignCast to assert pointer alignment |