| 1 | export fn a() void { |
| 2 | var box = Box{ .field = 0 }; |
| 3 | _ = &box; |
| 4 | box.*.field = 1; |
| 5 | } |
| 6 | export fn b() void { |
| 7 | var box = Box{ .field = 0 }; |
| 8 | const box_ptr = &box; |
| 9 | box_ptr.*.*.field = 1; |
| 10 | } |
| 11 | pub const Box = struct { |
| 12 | field: i32, |
| 13 | }; |
| 14 | |
| 15 | // error |
| 16 | // |
| 17 | // :4:8: error: cannot dereference non-pointer type 'tmp.Box' |
| 18 | // :11:17: note: struct declared here |
| 19 | // :9:14: error: cannot dereference non-pointer type 'tmp.Box' |
| 20 | // :11:17: note: struct declared here |