Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed May 16, 2024
1 parent bd29e21 commit af528fd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vlib/v/gen/c/cgen.v
Original file line number Diff line number Diff line change
Expand Up @@ -7130,14 +7130,15 @@ fn (mut g Gen) type_default(typ_ ast.Type) string {
if info.fields.all(it.has_default_expr) {
for field in info.fields {
field_sym := g.table.sym(field.typ)
field_name := c_name(field.name)
mut expr_str := ''
if field_sym.kind in [.sum_type, .interface_] {
expr_str = g.expr_string_with_cast(field.default_expr, field.default_expr_typ,
field.typ)
} else {
expr_str = g.expr_string(field.default_expr)
}
init_str += '${expr_str},'
init_str += '.${field_name} = ${expr_str},'
}
has_none_zero = true
}
Expand Down

0 comments on commit af528fd

Please sign in to comment.