We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 32be855 commit 4f773fcCopy full SHA for 4f773fc
vlib/v/gen/c/comptime.v
@@ -492,13 +492,16 @@ fn (mut g Gen) comptime_if(node ast.IfExpr) {
492
g.writeln('builtin___result_ok(&(${base_styp}[]) { ${tmp_var2} }, (_result*)(&${tmp_var}), sizeof(${base_styp}));')
493
g.writeln('}')
494
} else if is_array_fixed {
495
+ tmp_var2 := g.new_tmp_var()
496
base_styp := g.base_type(node.typ)
- g.write('memcpy(&${tmp_var}, (${base_styp})')
497
+ g.write('{ ${base_styp} ${tmp_var2} = ')
498
g.stmt(last)
499
if g.out.last_n(2).contains(';') {
500
g.go_back(2)
501
}
- g.write(', sizeof(${base_styp}))')
502
+ g.writeln(';')
503
+ g.writeln2('memcpy(&${tmp_var}, &${tmp_var2}, sizeof(${base_styp}));',
504
+ '}')
505
} else {
506
g.write('${tmp_var} = ')
507
0 commit comments