From 9ed33718f34625865d5ba9be732922aecc389ab3 Mon Sep 17 00:00:00 2001 From: antono2 Date: Wed, 24 Apr 2024 05:46:02 +0200 Subject: [PATCH] cgen: fix `myarr [1]C.mytype` fixed array fields, for `pub type C.mytype = voidptr` (#21266) --- vlib/v/gen/c/cgen.v | 3 --- vlib/v/tests/array_fixed_c_test.v | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 vlib/v/tests/array_fixed_c_test.v diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index ef0c8a0256..d27dd8e0a8 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -6570,9 +6570,6 @@ fn (mut g Gen) write_types(symbols []&ast.TypeSymbol) { } len := sym.info.size if len > 0 { - if fixed_elem_name.starts_with('C__') { - fixed_elem_name = fixed_elem_name[3..] - } if elem_sym.info is ast.FnType { pos := g.out.len g.write_fn_ptr_decl(&elem_sym.info, '') diff --git a/vlib/v/tests/array_fixed_c_test.v b/vlib/v/tests/array_fixed_c_test.v new file mode 100644 index 0000000000..ab9213cf07 --- /dev/null +++ b/vlib/v/tests/array_fixed_c_test.v @@ -0,0 +1,9 @@ +type C.ArrFixedCTestType = voidptr + +struct WrapperStruct { +mut: + arr_fixed_c_type [1]C.ArrFixedCTestType +} + +fn test_main() { +}