1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: fix const fixed array of reference var using correct pointer (#13023)

This commit is contained in:
yuyi 2022-01-04 17:34:07 +08:00 committed by GitHub
parent 59ed4be49a
commit 054bb272df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1132,15 +1132,8 @@ pub fn (mut g Gen) write_typedef_types() {
// .array_fixed {
styp := sym.cname
// array_fixed_char_300 => char x[300]
mut fixed := styp[12..]
len := styp.after('_')
fixed = fixed[..fixed.len - len.len - 1]
if fixed.starts_with('C__') {
fixed = fixed[3..]
}
if fixed.contains('ptr') {
fixed = 'void*'
}
mut fixed := g.typ(info.elem_type)
if elem_sym.info is ast.FnType {
pos := g.out.len
g.write_fn_ptr_decl(&elem_sym.info, '')