summary refs log tree commit diff stats
path: root/tests/ccgbugs/tret_arg_init.nim
blob: 5cd67de3e8c47f926b99f1c8fec74b3016089f01 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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