summary refs log tree commit diff stats
path: root/tests/cpp/tsigbreak.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cpp/tsigbreak.nim')
-rw-r--r--tests/cpp/tsigbreak.nim29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/cpp/tsigbreak.nim b/tests/cpp/tsigbreak.nim
new file mode 100644
index 000000000..14d29adf7
--- /dev/null
+++ b/tests/cpp/tsigbreak.nim
@@ -0,0 +1,29 @@
+discard """
+  targets: "cpp"
+  action: compile
+"""
+
+import tables, lists
+
+type
+  ListTable[K, V] = object
+    table: Table[K, DoublyLinkedNode[V]]
+
+proc initListTable*[K, V](initialSize = 64): ListTable[K, V] =
+  result.table = initTable[K, DoublyLinkedNode[V]]()
+
+proc `[]=`*[K, V](t: var ListTable[K, V], key: K, val: V) =
+  t.table[key].value = val
+
+type
+  SomeObj = object
+  OtherObj = object
+
+proc main() =
+  var someTable = initListTable[int, SomeObj]()
+  var otherTable = initListTable[int, OtherObj]()
+
+  someTable[1] = SomeObj()
+  otherTable[42] = OtherObj()
+
+main()