diff options
author | LemonBoy <LemonBoy@users.noreply.github.com> | 2019-02-06 09:14:09 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-02-06 09:14:09 +0100 |
commit | 4c3f8412122f20bac5a8812732b8a5762d0006d6 (patch) | |
tree | a1598155d8facb57ae5086ce84afe0000244d5bc | |
parent | 2e880c726b0072bec93e897e5caef8f5bbe3d6b6 (diff) | |
download | Nim-4c3f8412122f20bac5a8812732b8a5762d0006d6.tar.gz |
Do not raise ProveInit/WanrUninit for .noinit. var (#10566)
-rw-r--r-- | compiler/sempass2.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 622e72074..bf1b00aa0 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: |