2017-03-26 15:39:18 +08:00
|
|
|
const assert = @import("std").debug.assert;
|
|
|
|
|
|
|
|
const A = struct {
|
|
|
|
b: B,
|
|
|
|
};
|
|
|
|
|
|
|
|
const B = struct {
|
|
|
|
c: C,
|
|
|
|
};
|
|
|
|
|
|
|
|
const C = struct {
|
|
|
|
x: i32,
|
|
|
|
|
2018-05-31 22:56:59 +08:00
|
|
|
fn d(c: *const C) i32 {
|
2017-03-26 15:39:18 +08:00
|
|
|
return c.x;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-05-31 22:56:59 +08:00
|
|
|
fn foo(a: *const A) i32 {
|
2017-03-26 15:39:18 +08:00
|
|
|
return a.b.c.d();
|
|
|
|
}
|
|
|
|
|
|
|
|
test "incomplete struct param top level declaration" {
|
2018-05-29 08:23:55 +08:00
|
|
|
const a = A{
|
|
|
|
.b = B{
|
|
|
|
.c = C{ .x = 13 },
|
2017-03-26 15:39:18 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
assert(foo(a) == 13);
|
|
|
|
}
|