summary refs log tree commit diff stats
path: root/tests/errmsgs/t5870.nim
blob: 96966bcd7ed0d4c700e793745f7a8bbcaac8eac2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
discard """
errormsg: "invalid type: 'SomeRefObj' in this context: 'seq[SomeRefObj]' for const"
line: 14
"""

# bug #5870
type SomeRefObj = ref object of RootObj
    someIntMember: int

proc createSomeRefObj(v: int): SomeRefObj=
    result.new()
    result.someIntMember = v

const compileTimeSeqOfRefObjs = @[createSomeRefObj(100500), createSomeRefObj(2)]

for i in 0..1:
  echo compileTimeSeqOfRefObjs[i].someIntMember