summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2024-07-04 04:48:19 +0800
committerGitHub <noreply@github.com>2024-07-03 22:48:19 +0200
commit051a536275c8851adec4742f90c518fbbb65d13c (patch)
tree6b8e1176c618d940741cee5a32017120ee793c08 /compiler
parent903b1b10160a825a41af0908a930cde116f768ff (diff)
downloadNim-051a536275c8851adec4742f90c518fbbb65d13c.tar.gz
fixes #23784; don't allow fold paths containing `nkAddr` (#23792)
fixes #23784

notes that before https://github.com/nim-lang/Nim/pull/23477, it didn't
fold paths containing `addr`/`unsafeAddr` because it retained the form
of the magic function: `mAddr`.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semfold.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/semfold.nim b/compiler/semfold.nim
index 466df2e4e..10361eb79 100644
--- a/compiler/semfold.nim
+++ b/compiler/semfold.nim
@@ -703,7 +703,7 @@ proc getConstExpr(m: PSym, n: PNode; idgen: IdGenerator; g: ModuleGraph): PNode
   of nkAddr:
     var a = getConstExpr(m, n[0], idgen, g)
     if a != nil:
-      result = n
+      result = nil # don't fold paths containing nkAddr
       n[0] = a
   of nkBracket, nkCurly:
     result = copyNode(n)