summary refs log tree commit diff stats
path: root/tests/closure/tissue1846.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/closure/tissue1846.nim')
-rw-r--r--tests/closure/tissue1846.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/closure/tissue1846.nim b/tests/closure/tissue1846.nim
new file mode 100644
index 000000000..3fbef169d
--- /dev/null
+++ b/tests/closure/tissue1846.nim
@@ -0,0 +1,16 @@
+type
+    TBinOp*[T] = proc (x,y: T): bool
+
+    THeap*[T] = object
+        cmp*:   TBinOp[T]
+
+proc less*[T](x,y: T): bool =
+    x < y
+
+proc initHeap*[T](cmp: TBinOp[T]): THeap[T] =
+    result.cmp = cmp
+
+when isMainModule:
+    var h = initHeap[int](less[int])
+
+    echo h.cmp(2,3)
\ No newline at end of file