fixes #5402
This commit is contained in:
parent
71026cec6e
commit
6499462303
2 changed files with 31 additions and 4 deletions
26
tests/ccgbugs/tgeneric_smallobj_asgn_opt.nim
Normal file
26
tests/ccgbugs/tgeneric_smallobj_asgn_opt.nim
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
discard """
|
||||
output: '''false'''
|
||||
"""
|
||||
|
||||
# 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]()
|
||||
echo q.contains(123)
|
||||
Loading…
Add table
Add a link
Reference in a new issue