fixes #25369
This commit is contained in:
ringabout
2025-12-19 01:54:03 +08:00
committed by GitHub
parent 9bb57a64ba
commit 548b1c6ef8
3 changed files with 7 additions and 1 deletions

View File

@@ -969,7 +969,7 @@ proc p(n: PNode; c: var Con; s: var Scope; mode: ProcessMode; tmpFlags = {sfSing
isInProc
if isGlobalPragma:
c.graph.procGlobals.add n
c.graph.procGlobals.add newTree(nkFastAsgn, v, ri)
else:
let value = moveOrCopy(v, ri, c, s, if v.kind == nkSym: {IsDecl} else: {})
result.add value

View File

@@ -0,0 +1,2 @@
proc v*() =
let u {.global.} = default(ref int)

View File

@@ -62,3 +62,7 @@ proc m2() =
assert v == "123"
m2()
import mglobal3
block:
v()