Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
options
/
option_ptr_nil_test.v
21
lines
·
18
sloc
·
187 bytes
·
ef9bb8e628f3421447920d871b5f01c34af00f6b
Raw
1
struct
Foo {
2
name ?&string
3
}
4
5
struct
Foo2 {
6
mut
:
7
name ?&string
8
}
9
10
fn
test_1() {
11
_ := Foo{
12
name: unsafe { nil }
13
}
14
}
15
16
fn
test_2() {
17
mut
foo := Foo2{}
18
unsafe {
19
foo.name = nil
20
}
21
}
22