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

v.gen.c: fix calling pointer receiver on function return result (#10866)

This commit is contained in:
Uwe Krüger 2021-07-20 07:30:07 +02:00 committed by GitHub
parent eed4f50d8c
commit de39bba7bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -762,8 +762,13 @@ fn (mut g Gen) method_call(node ast.CallExpr) {
// Add `&` automatically.
// TODO same logic in call_args()
if !is_range_slice {
if !node.left.is_lvalue() {
g.write('ADDR($rec_cc_type, ')
has_cast = true
} else {
g.write('&')
}
}
} else if !node.receiver_type.is_ptr() && node.left_type.is_ptr() && node.name != 'str'
&& node.from_embed_type == 0 {
if !node.left_type.has_flag(.shared_f) {