stage2: fix returning structs byval from functions
This commit is contained in:
@@ -129,3 +129,18 @@ const MemberFnRand = struct {
|
||||
return r.seed;
|
||||
}
|
||||
};
|
||||
|
||||
test "return struct byval from function" {
|
||||
const bar = makeBar2(1234, 5678);
|
||||
try expect(bar.y == 5678);
|
||||
}
|
||||
const Bar = struct {
|
||||
x: i32,
|
||||
y: i32,
|
||||
};
|
||||
fn makeBar2(x: i32, y: i32) Bar {
|
||||
return Bar{
|
||||
.x = x,
|
||||
.y = y,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user