mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 06:18:51 +00:00
This commit is contained in:
@@ -563,7 +563,7 @@ proc semVarMacroPragma(c: PContext, a: PNode, n: PNode): PNode =
|
||||
return result
|
||||
|
||||
template isLocalSym(sym: PSym): bool =
|
||||
sym.kind in {skVar, skLet} and not
|
||||
sym.kind in {skVar, skLet, skParam} and not
|
||||
({sfGlobal, sfPure} * sym.flags != {} or
|
||||
sfCompileTime in sym.flags) or
|
||||
sym.kind in {skProc, skFunc, skIterator} and
|
||||
|
||||
9
tests/global/t21896.nim
Normal file
9
tests/global/t21896.nim
Normal file
@@ -0,0 +1,9 @@
|
||||
discard """
|
||||
errormsg: "cannot assign local to global variable"
|
||||
line: 7
|
||||
"""
|
||||
|
||||
proc example(a:int) =
|
||||
let b {.global.} = a
|
||||
|
||||
example(1)
|
||||
Reference in New Issue
Block a user