From 1672631815986e8d6695cc9e7ec151f78aa31fc5 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 18 May 2024 17:13:11 -0300 Subject: [PATCH] fix --- vlib/v/gen/c/cgen.v | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index b5f20e86b66198..e95096d35b8a22 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -2420,9 +2420,9 @@ fn (mut g Gen) write_sumtype_casting_fn(fun SumtypeCastingFn) { field_styp := g.typ(field.typ) if got_sym.kind in [.sum_type, .interface_] { // the field is already a wrapped pointer; we shouldn't wrap it once again - sb.write_string(', .${field.name} = ptr->${field.name}') + sb.write_string(', .${c_name(field.name)} = ptr->${field.name}') } else { - sb.write_string(', .${field.name} = (${field_styp}*)((char*)${ptr} + __offsetof_ptr(${ptr}, ${type_cname}, ${field.name}))') + sb.write_string(', .${c_name(field.name)} = (${field_styp}*)((char*)${ptr} + __offsetof_ptr(${ptr}, ${type_cname}, ${c_name(field.name)}))') } } sb.writeln('};\n}') @@ -6579,7 +6579,7 @@ fn (mut g Gen) write_types(symbols []&ast.TypeSymbol) { if sym.info.fields.len > 0 { g.writeln('\t// pointers to common sumtype fields') for field in sym.info.fields { - g.type_definitions.writeln('\t${g.typ(field.typ.ref())} ${field.name};') + g.type_definitions.writeln('\t${g.typ(field.typ.ref())} ${c_name(field.name)};') } } g.type_definitions.writeln('};')