Gitly
English
Русский
Español
日本語
中文
Português
Pricing
Log in
Register
v2
/
vlib
/
v
/
checker
/
tests
/
mut_assign_ref.vv
24
lines
·
20
sloc
·
238 bytes
·
e995d991f1279d3cee90bc4ea022f6cbcbedba96
Raw
1
struct Foo {
2
mut:
3
value int
4
}
5
6
const constant = Foo{100}
7
8
fn main() {
9
f := Foo{}
10
mut pf := &f
11
pf = &f
12
p := &f
13
_ = p
14
15
mut c := &constant
16
c.value = 200
17
c = &constant
18
ic := &constant
19
_ = ic
20
21
mut mf := f
22
pf = &mf // ok
23
_ = pf
24
}
25