Skip to content

Commit 76d43da

Browse files
committed
fix
1 parent ab1b0af commit 76d43da

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

vlib/v/gen/c/assign.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,8 @@ fn (mut g Gen) assign_stmt(node_ ast.AssignStmt) {
526526
} else {
527527
g.write('{${styp} _ = ')
528528
}
529-
if unaliased_right_sym.info is ast.ArrayFixed {
529+
if val !in [ast.StructInit, ast.ArrayInit]
530+
&& unaliased_right_sym.info is ast.ArrayFixed {
530531
tmp_var := g.expr_with_var(val, var_type, false)
531532
g.fixed_array_var_init(tmp_var, false, unaliased_right_sym.info.elem_type,
532533
unaliased_right_sym.info.size)

vlib/v/gen/c/match.v

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ fn (mut g Gen) need_tmp_var_in_match(node ast.MatchExpr) bool {
2525
if branch.stmts.len == 1 {
2626
if branch.stmts[0] is ast.ExprStmt {
2727
stmt := branch.stmts[0] as ast.ExprStmt
28+
if stmt.expr is ast.ArrayInit && stmt.expr.is_fixed {
29+
return true
30+
}
2831
if g.need_tmp_var_in_expr(stmt.expr) {
2932
return true
3033
}

0 commit comments

Comments
 (0)