From ea4435efa2dae5ad6832f454fd0e68e623face8b Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Wed, 25 Dec 2024 11:03:51 -0300 Subject: [PATCH] fix --- vlib/v/gen/c/cgen.v | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 1f9ded74636dc2..4dfc2e7b3e6a34 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -7285,7 +7285,11 @@ fn (mut g Gen) type_default_impl(typ_ ast.Type, decode_sumtype bool) string { && field_sym.info.is_empty_struct() { '{EMPTY_STRUCT_INITIALIZATION}' } else if field_sym.kind == .sum_type { - g.type_default_sumtype(field.typ, field_sym) + if decode_sumtype { + g.type_default_sumtype(field.typ, field_sym) + } else { + '{0}' + } } else { g.type_default(field.typ) }