mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
This commit is contained in:
parent
7b77f2ee5b
commit
36ca628c59
2 changed files with 17 additions and 0 deletions
|
@ -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() && arg.expr !is ast.CastExpr {
|
||||
g.write('(voidptr)&')
|
||||
} else {
|
||||
g.write('ADDR(${g.styp(atype)}, ')
|
||||
needs_closing = true
|
||||
|
|
15
vlib/v/tests/concurrency/chan_try_push_int_test.v
Normal file
15
vlib/v/tests/concurrency/chan_try_push_int_test.v
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue