mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
This commit is contained in:
parent
1623cc3a51
commit
073a651f7f
@ -2204,7 +2204,7 @@ fn (mut g Gen) ref_or_deref_arg(arg ast.CallArg, expected_type ast.Type, lang as
|
||||
if atype.has_flag(.generic) {
|
||||
atype = g.unwrap_generic(atype)
|
||||
}
|
||||
if atype.has_flag(.generic) {
|
||||
if atype.has_flag(.generic) || arg.expr is ast.StructInit {
|
||||
g.write('(voidptr)&/*qq*/')
|
||||
} else {
|
||||
needs_closing = true
|
||||
|
@ -0,0 +1,23 @@
|
||||
import eventbus
|
||||
|
||||
struct MyMessage {
|
||||
msg string
|
||||
}
|
||||
|
||||
fn test_fn_call_with_nonpointer_rvalue() {
|
||||
eb := eventbus.new()
|
||||
mut subscriber := eb.subscriber
|
||||
|
||||
subscriber.subscribe('my_publish', subscriber_method)
|
||||
|
||||
do_something(eb)
|
||||
assert true
|
||||
}
|
||||
|
||||
fn subscriber_method(receiver voidptr, ev &MyMessage, sender voidptr) {
|
||||
println(ev)
|
||||
}
|
||||
|
||||
fn do_something(eb &eventbus.EventBus) {
|
||||
eb.publish('my_publish', eb, MyMessage{ msg: 'this is my message' })
|
||||
}
|
Loading…
Reference in New Issue
Block a user