zig/test/cases/incomplete_struct_param_tld.zig

31 lines
417 B
Zig
Raw Normal View History

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