toutparam.nim 414 B

1234567891011121314151617181920212223242526272829
  1. discard """
  2. cmd: '''nim c --warningAsError:Uninit:on --skipCfg --skipParentCfg $file'''
  3. errormsg: "use explicit initialization of 'x' for clarity [Uninit]"
  4. line: 24
  5. disabled: "true"
  6. """
  7. proc gah[T](x: out T) =
  8. x = 3
  9. proc main =
  10. var a: array[2, int]
  11. var x: int
  12. gah(x)
  13. a[0] = 3
  14. a[x] = 3
  15. echo x
  16. main()
  17. proc mainB =
  18. var a: array[2, int]
  19. var x: int
  20. a[0] = 3
  21. a[x] = 3
  22. echo x
  23. mainB()