v2 / vlib / v / tests / structs / struct_shared_field_init_test.v
22 lines · 19 sloc · 195 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1struct AA {
2 b shared BB
3}
4
5struct BB {
6 a &int
7}
8
9struct CC {
10 a BB
11}
12
13fn test_struct_shared_field_init() {
14 a := 3
15 table := &AA{
16 b: BB{&a}
17 }
18 c := CC{
19 a: table.b
20 }
21 assert *c.a.a == 3
22}
23