summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cpp/tconstructor.nim35
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/cpp/tconstructor.nim b/tests/cpp/tconstructor.nim
index b69162661..32fb5e1a2 100644
--- a/tests/cpp/tconstructor.nim
+++ b/tests/cpp/tconstructor.nim
@@ -7,6 +7,15 @@ discard """
 123
 0
 123
+___
+0
+777
+10
+123
+0
+777
+10
+123
 '''
 """
 
@@ -73,4 +82,28 @@ proc main =
     n.x = 123
     echo n.x
 
-main()
\ No newline at end of file
+main()
+#bug:
+echo "___"
+type
+  NimClassWithDefault = object
+    x: int
+    y = 777
+    case kind: bool = true
+    of true:
+      z: int = 10
+    else: discard
+
+proc makeNimClassWithDefault(): NimClassWithDefault {.constructor.} =
+  discard
+
+proc init =
+  for i in 0 .. 1:
+    var n = makeNimClassWithDefault()
+    echo n.x
+    echo n.y
+    echo n.z
+    n.x = 123
+    echo n.x
+
+init()
\ No newline at end of file