| 1 | const S = packed struct { |
| 2 | ptr: *u32, |
| 3 | }; |
| 4 | export fn foo() void { |
| 5 | _ = @as(S, undefined); |
| 6 | } |
| 7 | |
| 8 | const U = packed union { |
| 9 | ptr: *u32, |
| 10 | }; |
| 11 | export fn bar() void { |
| 12 | _ = @as(U, undefined); |
| 13 | } |
| 14 | |
| 15 | // error |
| 16 | // |
| 17 | // :2:10: error: packed structs cannot contain fields of type '*u32' |
| 18 | // :2:10: note: pointers cannot be directly bitpacked |
| 19 | // :2:10: note: consider using 'usize' and '@intFromPtr' |
| 20 | // :9:10: error: packed unions cannot contain fields of type '*u32' |
| 21 | // :9:10: note: pointers cannot be directly bitpacked |
| 22 | // :9:10: note: consider using 'usize' and '@intFromPtr' |