Skip to content

Instantly share code, notes, and snippets.

@eliezedeck
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliezedeck/112d92ae108f06c4ebc6 to your computer and use it in GitHub Desktop.
Save eliezedeck/112d92ae108f06c4ebc6 to your computer and use it in GitHub Desktop.
# Warning: not GC-safe: 't' [GcUnsafe] -- generated when using objects (t here) that have closures as member.
# Compile with --threads:on
type
TTTTT = object
onCalled: proc(i: int) {.closure.}
var
t: TTTTT # <== This is GCed, so the whole 't' instance is not gcsafe
x = 0
t.onCalled = proc(i: int) {.closure.} = # <== warning here
echo "Dummy closure proc, " & $i
t.onCalled(x) # <== warning here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment