Skip to content

Commit

Permalink
Do not raise ProveInit/WanrUninit for .noinit. var (#10566)
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonBoy authored and Araq committed Feb 6, 2019
1 parent 2e880c7 commit 4c3f841
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/sempass2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4c3f841

Please sign in to comment.