t19435.nim 464 B

1234567891011121314151617181920212223242526272829
  1. discard """
  2. matrix: "--gc:arc"
  3. """
  4. # bug #19435
  5. {.experimental: "views".}
  6. type
  7. Bar = object
  8. placeholder: int
  9. Foo = object
  10. placeholder: int
  11. c: seq[Bar] # remove this line to make things right
  12. func children*(s: var seq[Foo]): openArray[Foo] =
  13. s.toOpenArray(0, s.len-1)
  14. proc test =
  15. var foos = @[Foo(), Foo()]
  16. assert foos.children.len == 2
  17. var flag = true
  18. for a in foos.children:
  19. flag = false
  20. if flag:
  21. doAssert false
  22. test()