v/vlib/v/fmt/tests/struct_init_with_ref_cast_k...

23 lines
208 B
V

struct Foo {
f int = 123
}
struct Bar {
f &Foo = &Foo(0)
}
struct Zar {
f Foo
}
fn main() {
b := &Bar{
f: &Foo(32)
}
c := &Zar{
f: Foo{456}
}
assert ptr_str(b.f) == '20'
assert c.f.f == 456
}