zig/test/behavior/incomplete_struct_param_tld.zig
Andrew Kelley 4307436b99 move behavior tests from test/stage1/ to test/
And fix test cases to make them pass. This is in preparation for
starting to pass behavior tests with self-hosted.
2021-04-29 15:54:04 -07:00

31 lines
412 B
Zig

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 },
},
};
expect(foo(a) == 13);
}