From 4c3f8412122f20bac5a8812732b8a5762d0006d6 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 6 Feb 2019 09:14:09 +0100 Subject: [PATCH] Do not raise ProveInit/WanrUninit for .noinit. var (#10566) --- compiler/sempass2.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 622e72074b09..bf1b00aa0a88 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -232,7 +232,10 @@ proc listGcUnsafety(s: PSym; onlyWarning: bool; conf: ConfigRef) = proc useVar(a: PEffects, n: PNode) = let s = n.sym if isLocalVar(a, s): - if s.id notin a.init: + if sfNoInit in s.flags: + # If the variable is explicitly marked as .noinit. do not emit any error + a.init.add s.id + elif s.id notin a.init: if {tfNeedsInit, tfNotNil} * s.typ.flags != {}: message(a.config, n.info, warnProveInit, s.name.s) else: