summary refs log tree commit diff stats
path: root/lib/core
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-03-15 11:18:05 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-03-15 17:51:52 +0100
commit831626be859010eeddfae312031dade380690037 (patch)
tree1c4d31e46016ed2f31f225ac3c539ee132552238 /lib/core
parent5dea7c5ad7bdd0f410e2c1ff0bf46e18d4284e56 (diff)
downloadNim-831626be859010eeddfae312031dade380690037.tar.gz
newruntime: make dynamic destructors compatible with C++
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/runtime_v2.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/core/runtime_v2.nim b/lib/core/runtime_v2.nim
index 4367954d1..372c364db 100644
--- a/lib/core/runtime_v2.nim
+++ b/lib/core/runtime_v2.nim
@@ -27,8 +27,9 @@ hash of ``package & "." & module & "." & name`` to save space.
 
 type
   TNimNode {.compilerProc.} = object # to keep the code generator simple
+  DestructorProc = proc (p: pointer) {.nimcall, benign.}
   TNimType {.compilerProc.} = object
-    destructor: proc (p: pointer) {.nimcall, benign.}
+    destructor: pointer
     size: int
     name: cstring
   PNimType = ptr TNimType
@@ -65,7 +66,7 @@ proc nimRawDispose(p: pointer) {.compilerRtl.} =
 
 proc nimDestroyAndDispose(p: pointer) {.compilerRtl.} =
   let d = cast[ptr PNimType](p)[].destructor
-  if d != nil: d(p)
+  if d != nil: cast[DestructorProc](d)(p)
   nimRawDispose(p)
 
 proc isObj(obj: PNimType, subclass: cstring): bool {.compilerproc.} =