Skip to content

Commit

Permalink
add reproducible tests for 15 until I can investigate
Browse files Browse the repository at this point in the history
  • Loading branch information
Clonkk committed Jun 28, 2021
1 parent ad46fa5 commit ad86a36
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/destroy_bug_15.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import cppstl/std_vector

type Foo = object
x: int

proc `=destroy`*(a: var Foo) {.inline.} =
echo ("in destroy", a.x)

proc main =
var v = initCppVector[Foo]()

v.add Foo(x: 10)
v.add Foo(x: 11)
v.add Foo(x: 12)

echo "ok0"
echo v

echo "ok1"
echo v

echo "ok2"

# Clear should call object destructor
v.clear()
echo "ok3"

main()

0 comments on commit ad86a36

Please sign in to comment.