v2 / vlib / v / checker / tests / assign_immutable_reference_var_err.vv
16 lines · 14 sloc · 131 bytes · 757929392e0e7a75fc1272116460981e589737d5
Raw
1@[heap]
2struct Foo {
3mut:
4 value int
5}
6
7fn y(x &Foo) {
8 mut m := x
9 m.value = 42
10}
11
12fn main() {
13 x := Foo{123}
14 y(x)
15 println(x)
16}
17