summary refs log tree commit diff stats
path: root/compiler/sempass2.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/sempass2.nim')
-rw-r--r--compiler/sempass2.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim
index b2b91490c..72666e47d 100644
--- a/compiler/sempass2.nim
+++ b/compiler/sempass2.nim
@@ -71,7 +71,7 @@ type
     init: seq[int] # list of initialized variables
     guards: TModel # nested guards
     locked: seq[PNode] # locked locations
-    gcUnsafe: bool
+    gcUnsafe, isRecursive: bool
   PEffects = var TEffects
 
 proc isLocalVar(a: PEffects, s: PSym): bool =
@@ -502,7 +502,9 @@ proc track(tracked: PEffects, n: PNode) =
     # are indistinguishable from normal procs (both have tyProc type) and
     # we can detect them only by checking for attached nkEffectList.
     if op != nil and op.kind == tyProc and op.n.sons[0].kind == nkEffectList:
-      if notGcSafe(op) and not importedFromC(a):
+      if a.kind == nkSym and a.sym == tracked.owner:
+        tracked.isRecursive = true
+      elif notGcSafe(op) and not importedFromC(a):
         message(n.info, warnGcUnsafe, renderTree(n))
         tracked.gcUnsafe = true
       var effectList = op.n.sons[0]