v2 / vlib / v / gen / c / testdata / shared_call_arg_struct_init.vv
22 lines · 19 sloc · 213 bytes · 3dfe45a33e11eacc61a5dddd702e7652c8c03230
Raw
1struct Options {
2 a int
3}
4
5struct Obj {
6 a int
7}
8
9fn make_obj(options Options) Obj {
10 return Obj{
11 a: options.a
12 }
13}
14
15fn main() {
16 shared obj := make_obj(Options{
17 a: 1
18 })
19 rlock obj {
20 assert obj.a == 1
21 }
22}
23