diff --git a/vlib/v/gen/c/str.v b/vlib/v/gen/c/str.v index 2fe856be78cec1..547be62d6c5d2b 100644 --- a/vlib/v/gen/c/str.v +++ b/vlib/v/gen/c/str.v @@ -232,7 +232,7 @@ fn (mut g Gen) gen_expr_to_string(expr ast.Expr, etype ast.Type) { if str_method_expects_ptr && !is_ptr && !typ.has_flag(.option) { g.write('&') } else if (!str_method_expects_ptr && is_ptr && !is_shared) || is_var_mut { - g.write('*') + g.write('*'.repeat(typ.nr_muls())) } else { if sym.is_c_struct() { g.write(c_struct_ptr(sym, typ, str_method_expects_ptr)) diff --git a/vlib/v/tests/generics/generic_muls_test.v b/vlib/v/tests/generics/generic_muls_test.v new file mode 100644 index 00000000000000..c5940c364470a9 --- /dev/null +++ b/vlib/v/tests/generics/generic_muls_test.v @@ -0,0 +1,12 @@ +fn test_main() { + la := 'lalala' + la2 := &la + la3 := &la2 + a(la3) +} + +fn a[T](t &&T) { + println(t) + dump(t) + assert **t == 'lalala' +}