summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorcooldome <cdome@bk.ru>2019-03-12 12:45:05 +0000
committerAndreas Rumpf <rumpf_a@web.de>2019-03-12 13:45:05 +0100
commit8ceba8a7f3af9999d39d96cba319bce51c33a0d7 (patch)
tree3e6a17be6d2ddc2642bac3dbecd650dcfe672008 /tests
parentea3e18bc6cd6f37581d65fb13512fdde35bed95c (diff)
downloadNim-8ceba8a7f3af9999d39d96cba319bce51c33a0d7.tar.gz
fixes #10807 (#10814)
* fixes  #10807
* use nkAddr instead of nkHiddenAddr
Diffstat (limited to 'tests')
-rw-r--r--tests/macros/tmacrostmt.nim12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/macros/tmacrostmt.nim b/tests/macros/tmacrostmt.nim
index e4b8e2fe4..b67962c86 100644
--- a/tests/macros/tmacrostmt.nim
+++ b/tests/macros/tmacrostmt.nim
@@ -91,14 +91,24 @@ proc fn2(x, y: float): float =
 
 proc fn3(x, y: int): bool =
   (((x and 3) div 4) or (x mod (y xor -1))) == 0 or y notin [1,2]
-  
+
+
+#------------------------------------
+# bug #10807
+proc fn_unsafeaddr(x: int): int = 
+  cast[int](unsafeAddr(x))
+
 static:
+  echo fn_unsafeaddr.repr_to_string 
   let fn1s = "proc fn1(x, y: int): int =\n  result = 2 * (x + y)\n"
   let fn2s = "proc fn2(x, y: float): float =\n  result = (y + 2 * x) / (x - y)\n"
   let fn3s = "proc fn3(x, y: int): bool =\n  result = ((x and 3) div 4 or x mod (y xor -1)) == 0 or not contains([1, 2], y)\n"
+  let fnAddr = "proc fn_unsafeaddr(x: int): int =\n  result = cast[int](unsafeAddr(x))\n"
+  
   doAssert fn1.repr_to_string == fn1s
   doAssert fn2.repr_to_string == fn2s
   doAssert fn3.repr_to_string == fn3s
+  doAssert fn_unsafeaddr.repr_to_string == fnAddr
 
 #------------------------------------
 # bug #8763