diff options
author | Araq <rumpf_a@web.de> | 2016-10-22 13:41:46 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2016-10-22 13:41:46 +0200 |
commit | cdd69e951f3861b47f3d71bdf6a9aa09d6575100 (patch) | |
tree | 943bc9b139078e8b54abebe2d4c05e561756214a | |
parent | 062b7e8b464c2194c4bf99acaf90c5e96ce98a57 (diff) | |
download | Nim-cdd69e951f3861b47f3d71bdf6a9aa09d6575100.tar.gz |
fixes #4927
-rw-r--r-- | compiler/sempass2.nim | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 1c61373c2..8aa8f15c8 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -204,17 +204,22 @@ proc listGcUnsafety(s: PSym; onlyWarning: bool; cycleCheck: var IntSet) = let u = s.gcUnsafetyReason if u != nil and not cycleCheck.containsOrIncl(u.id): let msgKind = if onlyWarning: warnGcUnsafe2 else: errGenerated - if u.kind in {skLet, skVar}: + case u.kind + of skLet, skVar: message(s.info, msgKind, ("'$#' is not GC-safe as it accesses '$#'" & " which is a global using GC'ed memory") % [s.name.s, u.name.s]) - elif u.kind in routineKinds: + of routineKinds: # recursive call *always* produces only a warning so the full error # message is printed: listGcUnsafety(u, true, cycleCheck) message(s.info, msgKind, "'$#' is not GC-safe as it calls '$#'" % [s.name.s, u.name.s]) + of skParam: + message(s.info, msgKind, + "'$#' is not GC-safe as it performs an indirect call via '$#'" % + [s.name.s, u.name.s]) else: internalAssert u.kind == skUnknown message(u.info, msgKind, |