mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 06:18:51 +00:00
For memory-safety, this only seems problematic in case of closures, so I just special cased that. Fixes #25131
18 lines
191 B
Nim
18 lines
191 B
Nim
discard """
|
|
output: "hi\nhi"
|
|
"""
|
|
|
|
type X = object
|
|
p: proc() {.nimcall.}
|
|
|
|
proc main() =
|
|
proc p() =
|
|
echo "hi"
|
|
|
|
let a {.global.} = p
|
|
let b {.global.} = X(p: p)
|
|
a()
|
|
b.p()
|
|
|
|
main()
|