diff options
Diffstat (limited to 'tests/ccgbugs/tgeneric_smallobj_asgn_opt.nim')
-rw-r--r-- | tests/ccgbugs/tgeneric_smallobj_asgn_opt.nim | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ccgbugs/tgeneric_smallobj_asgn_opt.nim b/tests/ccgbugs/tgeneric_smallobj_asgn_opt.nim new file mode 100644 index 000000000..3788b9985 --- /dev/null +++ b/tests/ccgbugs/tgeneric_smallobj_asgn_opt.nim @@ -0,0 +1,27 @@ +discard """ + output: "done generic smallobj asgn opt" +""" + +# bug #5402 + +import lists + +type + Container[T] = ref object + obj: T + + ListOfContainers[T] = ref object + list: DoublyLinkedList[Container[T]] + +proc contains[T](this: ListOfContainers[T], obj: T): bool = + for item in this.list.items(): + if item.obj == obj: return true + return false + +proc newListOfContainers[T](): ListOfContainers[T] = + new(result) + result.list = initDoublyLinkedList[Container[T]]() + +let q = newListOfContainers[int64]() +if not q.contains(123): + echo "done generic smallobj asgn opt" |