mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 15:42:49 +00:00
34 lines
535 B
Zig
34 lines
535 B
Zig
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" {
|
|
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
|
|
|
const a = A{
|
|
.b = B{
|
|
.c = C{ .x = 13 },
|
|
},
|
|
};
|
|
try expect(foo(a) == 13);
|
|
}
|