vxx2 / vlib / v / checker / tests / immutable_pointer_selector_field_err.vv
22 lines · 19 sloc · 251 bytes · 6e63a22212c65a49734ed499ab6d92fef84ead48
Raw
1struct AnotherStruct {
2mut:
3 str string
4}
5
6@[params]
7struct MyOptions {
8 data &AnotherStruct
9}
10
11fn fn_test(args MyOptions) {
12 mut x := args.data
13 x.str = 'why is this possible?'
14}
15
16fn main() {
17 fn_test(
18 data: &AnotherStruct{
19 str: 'test'
20 }
21 )
22}
23