t5870.nim 421 B

123456789101112131415161718
  1. discard """
  2. errormsg: "invalid type: 'SomeRefObj' in this context: 'seq[SomeRefObj]' for const"
  3. line: 14
  4. """
  5. # bug #5870
  6. type SomeRefObj = ref object of RootObj
  7. someIntMember: int
  8. proc createSomeRefObj(v: int): SomeRefObj=
  9. result.new()
  10. result.someIntMember = v
  11. const compileTimeSeqOfRefObjs = @[createSomeRefObj(100500), createSomeRefObj(2)]
  12. for i in 0..1:
  13. echo compileTimeSeqOfRefObjs[i].someIntMember