mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 14:23:45 +00:00
For memory-safety, this only seems problematic in case of closures, so I just special cased that. Fixes #25131
15 lines
172 B
Nim
15 lines
172 B
Nim
discard """
|
|
errormsg: "cannot assign local to global variable"
|
|
line: 11
|
|
"""
|
|
|
|
proc main() =
|
|
var x = "hi"
|
|
proc p() =
|
|
echo x
|
|
|
|
let a {.global.} = p
|
|
p()
|
|
|
|
main()
|