| 1 | const std = @import("std"); |
| 2 | const expect = std.testing.expect; |
| 3 | const builtin = @import("builtin"); |
| 4 | |
| 5 | test "struct contains null pointer which contains original struct" { |
| 6 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 7 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 8 | |
| 9 | var x: ?*NodeLineComment = null; |
| 10 | _ = &x; |
| 11 | try expect(x == null); |
| 12 | } |
| 13 | |
| 14 | pub const Node = struct { |
| 15 | id: Id, |
| 16 | comment: ?*NodeLineComment, |
| 17 | |
| 18 | pub const Id = enum { |
| 19 | Root, |
| 20 | LineComment, |
| 21 | }; |
| 22 | }; |
| 23 | |
| 24 | pub const NodeLineComment = struct { |
| 25 | base: Node, |
| 26 | }; |