summary refs log tree commit diff stats
path: root/tests/global
diff options
context:
space:
mode:
authorBung <crc32@qq.com>2023-05-24 21:30:14 +0800
committerGitHub <noreply@github.com>2023-05-24 15:30:14 +0200
commit266cc69f1973773228534f074febd153c472b949 (patch)
treebecee58cd91e73427266eaf76285a2e1cdf3207b /tests/global
parent761b927e4700ecda2dde8b16fb8beab791436e99 (diff)
downloadNim-266cc69f1973773228534f074febd153c472b949.tar.gz
fix #21896 asign parameter to global variable generates invalid code (#21900)
Diffstat (limited to 'tests/global')
-rw-r--r--tests/global/t21896.nim9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/global/t21896.nim b/tests/global/t21896.nim
new file mode 100644
index 000000000..c7765c4dd
--- /dev/null
+++ b/tests/global/t21896.nim
@@ -0,0 +1,9 @@
+discard """
+  errormsg: "cannot assign local to global variable"
+  line: 7
+"""
+
+proc example(a:int) =
+  let b {.global.} = a
+
+example(1)