From a5bd98610fe772ead179a0768d6042327354ab2e Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Mon, 23 Mar 2020 17:23:10 +1100 Subject: [PATCH] cgen: call arg ref fix --- vlib/v/gen/cgen.v | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index cf688621a5..1bd3b2d382 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -1638,12 +1638,12 @@ fn (g mut Gen) call_args(args []ast.CallArg) { [inline] fn (g mut Gen) ref_or_deref_arg(arg ast.CallArg) { - arg_is_ptr := table.type_is_ptr(arg.expected_type) || arg.expected_type == table.voidptr_type_idx - expr_is_ptr := table.type_is_ptr(arg.typ) + arg_is_ptr := table.type_is_ptr(arg.expected_type) || table.type_idx(arg.expected_type) in table.pointer_type_idxs + expr_is_ptr := table.type_is_ptr(arg.typ) || table.type_idx(arg.typ) in table.pointer_type_idxs if arg.is_mut && !arg_is_ptr { g.write('&/*mut*/') } - else if arg_is_ptr && !expr_is_ptr && arg.typ != table.byteptr_type { + else if arg_is_ptr && !expr_is_ptr { g.write('&/*q*/') } else if !arg_is_ptr && expr_is_ptr {