diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-01-03 01:21:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-03 01:21:45 +0100 |
commit | 0ecb709cbeec2e77d6ce8dae251270a7d1e3826e (patch) | |
tree | ae1562c73b698473830ee05f3753cc44b14e4998 /tests/destructor | |
parent | c949b81efdeb08b38224e1678ad140b7b7663b15 (diff) | |
download | Nim-0ecb709cbeec2e77d6ce8dae251270a7d1e3826e.tar.gz |
fixes #12978 (#13012)
Diffstat (limited to 'tests/destructor')
-rw-r--r-- | tests/destructor/tcomplexobjconstr.nim | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/destructor/tcomplexobjconstr.nim b/tests/destructor/tcomplexobjconstr.nim index 23c615783..fd112b6e2 100644 --- a/tests/destructor/tcomplexobjconstr.nim +++ b/tests/destructor/tcomplexobjconstr.nim @@ -1,5 +1,6 @@ discard """ - output: "true" + output: '''true +OK''' cmd: "nim c --gc:arc $file" """ @@ -31,3 +32,25 @@ assert y.more[2] of MyObject1 assert y.more[2] of RootObj echo "true" + +# bug #12978 +type + Vector2* = object of RootObj + x*, y*: float + +type + Vertex* = ref object + point*: Vector2 + +proc newVertex*(p: Vector2): Vertex = + return Vertex(point: p) + +proc createVertex*(p: Vector2): Vertex = + result = newVertex(p) + +proc p = + var x = Vector2(x: 1, y: 2) + let other = createVertex(x) + echo "OK" + +p() |