This commit is contained in:
Felipe Pena 2025-08-09 16:35:35 -03:00
parent a2f65c6977
commit 3fe4092831
2 changed files with 17 additions and 0 deletions

View file

@ -2707,6 +2707,8 @@ fn (mut g Gen) ref_or_deref_arg(arg ast.CallArg, expected_type ast.Type, lang as
}
if arg.expr.is_as_cast() {
g.inside_smartcast = true
} else if arg_typ_sym.is_int() {
g.write('(voidptr)&')
} else {
g.write('ADDR(${g.styp(atype)}, ')
needs_closing = true

View file

@ -0,0 +1,15 @@
struct Foo {
mut:
value int = 123
}
fn test_main() {
shared m := Foo{}
ch := chan int{cap: 1}
ch.try_push(rlock m {
m.value
})
mut tmp := int(0)
ch.try_pop(mut tmp)
assert tmp == 123
}