aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/struct_contains_null_ptr_itself.zig
blob: 28aa1d57aa60182872e3c0916f2dc6438935d55f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const std = @import("std");
const expect = std.testing.expect;

test "struct contains null pointer which contains original struct" {
    var x: ?*NodeLineComment = null;
    try expect(x == null);
}

pub const Node = struct {
    id: Id,
    comment: ?*NodeLineComment,

    pub const Id = enum {
        Root,
        LineComment,
    };
};

pub const NodeLineComment = struct {
    base: Node,
};