summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2024-04-15 23:28:14 +0800
committerGitHub <noreply@github.com>2024-04-15 17:28:14 +0200
commit549ef24f35213302ba66e9e786c18ab9146940ee (patch)
treee188e18455068466a5ad2f39168868c5189c452d /tests
parent7208a27c0f8396e6a6e73b36c92c870390bd0287 (diff)
downloadNim-549ef24f35213302ba66e9e786c18ab9146940ee.tar.gz
fixes #23499; don't skip `addr` when constructing `bracketExpr` (#23503)
fixes #23499

In the
https://github.com/nim-lang/Nim/commit/8990626ca9715a3687b28331aee4ccf242997aa2
the effect of `skipAddr` changed to skip `nkAddr` and `nkHiddenAddr`.
Some old code was not adapted. In the
https://github.com/nim-lang/Nim/pull/23477, the magic `addr` function
was handled in the semantic analysis phase, which causes it be skipped
incorrectly
Diffstat (limited to 'tests')
-rw-r--r--tests/misc/taddr.nim10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/misc/taddr.nim b/tests/misc/taddr.nim
index 48d4928ac..64f95c7e3 100644
--- a/tests/misc/taddr.nim
+++ b/tests/misc/taddr.nim
@@ -273,6 +273,16 @@ proc test15939() = # bug #15939 (v2)
   else: # can't take address of cstring element in js
     when not defined(js): cstringTest()
 
+block: # bug #23499
+  template volatileStore[T](dest: ptr T, val: T) =
+    dest[] = val
+
+  proc foo =
+    var ctr = 0
+    volatileStore(addr ctr, 0)
+
+  foo()
+
 template main =
   # xxx wrap all other tests here like that so they're also tested in VM
   test14420()