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

checker: fix struct init with update expr (fix #9472) (#15460)

This commit is contained in:
yuyi
2022-08-19 00:39:41 +08:00
committed by GitHub
parent 22a79cfa1e
commit 6d399c5116
4 changed files with 53 additions and 14 deletions

View File

@@ -563,11 +563,6 @@ pub fn (mut c Checker) struct_init(mut node ast.StructInit) ast.Type {
node.update_expr.pos())
}
}
if !node.update_expr.is_lvalue() {
// cgen will repeat `update_expr` for each field
// so enforce an lvalue for efficiency
c.error('expression is not an lvalue', node.update_expr.pos())
}
}
return node.typ
}