diff --git a/compiler/gen_c.v b/compiler/gen_c.v index 3585fd88d4..c00260218a 100644 --- a/compiler/gen_c.v +++ b/compiler/gen_c.v @@ -461,7 +461,11 @@ fn (p mut Parser) gen_array_push(ph int, typ, expr_type, tmp, tmp_typ string) { // Don't dereference if it's already a mutable array argument (`fn foo(mut []int)`) push_call := if typ.contains('*'){'_PUSH('} else { '_PUSH(&'} p.cgen.set_placeholder(ph, push_call) - p.gen('), $tmp, $tmp_typ)') + if tmp_typ.ends_with('*') { + p.gen('), $tmp, ${tmp_typ.left(tmp_typ.len - 1)})') + } else { + p.gen('), $tmp, $tmp_typ)') + } } }