aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/incomplete_struct_param_tld.zig
blob: 29f57ed971a4d6f30b56cb43e78b4e4d68415a79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const builtin = @import("builtin");
const expect = @import("std").testing.expect;

const A = struct {
    b: B,
};

const B = struct {
    c: C,
};

const C = struct {
    x: i32,

    fn d(c: *const C) i32 {
        return c.x;
    }
};

fn foo(a: A) i32 {
    return a.b.c.d();
}

test "incomplete struct param top level declaration" {
    const a = A{
        .b = B{
            .c = C{ .x = 13 },
        },
    };
    try expect(foo(a) == 13);
}