diff --git a/vlib/v/gen/c/index.v b/vlib/v/gen/c/index.v index 8ff1dd7633..24540b51a8 100644 --- a/vlib/v/gen/c/index.v +++ b/vlib/v/gen/c/index.v @@ -115,17 +115,8 @@ fn (mut g Gen) range_expr(node ast.IndexExpr, range ast.RangeExpr) { g.write('array_slice(') } g.write('new_array_from_c_array${noscan}(') - g.write('$info.size') - g.write(', $info.size') - g.write(', sizeof(') - if node.left_type.is_ptr() { - g.write('(*') - } - g.expr(node.left) - if node.left_type.is_ptr() { - g.write(')') - } - g.write('[0]), ') + ctype := g.typ(info.elem_type) + g.write('$info.size, $info.size, sizeof($ctype), ') if node.left_type.is_ptr() { g.write('*') }