From 549ef24f35213302ba66e9e786c18ab9146940ee Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Mon, 15 Apr 2024 23:28:14 +0800 Subject: 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 --- tests/misc/taddr.nim | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') 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() -- cgit 1.4.1-2-gfad0