1const builtin = @import("builtin");
2const expect = @import("std").testing.expect;
3
4const A = struct {
5 b: B,
6};
7
8const B = struct {
9 c: C,
10};
11
12const C = struct {
13 x: i32,
14
15 fn d(c: *const C) i32 {
16 return c.x;
17 }
18};
19
20fn foo(a: A) i32 {
21 return a.b.c.d();
22}
23
24test "incomplete struct param top level declaration" {
25 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
26 if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest;
27
28 const a = A{
29 .b = B{
30 .c = C{ .x = 13 },
31 },
32 };
33 try expect(foo(a) == 13);
34}