diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index b0463e76c3..dfb76983a0 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -372,9 +372,9 @@ proc useVarNoInitCheck(a: PEffects; n: PNode; s: PSym) = proc useVar(a: PEffects, n: PNode) = let s = n.sym - if a.inExceptOrFinallyStmt > 0: - incl s, sfUsedInFinallyOrExcept if isLocalSym(a, s): + if a.inExceptOrFinallyStmt > 0: + incl s, sfUsedInFinallyOrExcept if sfNoInit in s.flags: # If the variable is explicitly marked as .noinit. do not emit any error a.init.add s.id