Files
yaegi/_test/fun28.go
T
Marc Vertes 6aa4f45c42 interp: wrap source functions when used as input parameters.
It allows to use interpreter functions as parameters in the runtime, even for defered callbacks, or when passed as empty interfaces, as for runtime.SetFinalizer.

Fixes #1503
2023-02-08 12:04:05 +01:00

26 lines
260 B
Go

package main
import (
"runtime"
)
type T struct {
name string
}
func finalize(t *T) { println("finalize") }
func newT() *T {
t := new(T)
runtime.SetFinalizer(t, finalize)
return t
}
func main() {
t := newT()
println(t != nil)
}
// Output:
// true