vxx2 / vlib / v / checker / tests / unsafe_required.vv
21 lines · 17 sloc · 211 bytes · 0c8ce3bcb9fd4a2e5bd5f991a5a07da976d780d7
Raw
1struct S1 {}
2
3@[unsafe]
4fn (s S1) f() {}
5
6fn test_funcs() {
7 s := S1{}
8 s.f()
9}
10
11fn test_ptr_index(mut a []string) {
12 _ = a[0] // OK
13 b := ['jo']
14 _ = b[0] // OK
15 c := &b
16 _ = c[0]
17
18 v := 4
19 p := &v
20 _ = p[0]
21}
22