summary refs log tree commit diff stats
path: root/tests/ccgbugs/tret_arg_init.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ccgbugs/tret_arg_init.nim')
-rw-r--r--tests/ccgbugs/tret_arg_init.nim28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ccgbugs/tret_arg_init.nim b/tests/ccgbugs/tret_arg_init.nim
new file mode 100644
index 000000000..e39e5a0de
--- /dev/null
+++ b/tests/ccgbugs/tret_arg_init.nim
@@ -0,0 +1,28 @@
+discard """
+  output: '''
+
+
+
+'''
+"""
+
+type Bar = object
+  s1, s2: string
+
+proc initBar(): Bar = discard
+
+var a: array[5, Bar]
+a[0].s1 = "hey"
+a[0] = initBar()
+echo a[0].s1
+
+type Foo = object
+  b: Bar
+var f: Foo
+f.b.s1 = "hi"
+f.b = initBar()
+echo f.b.s1
+
+var ad = addr f.b
+ad[] = initBar()
+echo ad[].s1