summary refs log tree commit diff stats
path: root/tests/effects/toutparam.nim
blob: 1126aa77e79f8a45943a59ee0c88893f77347ce7 (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
27
28
discard """
  cmd: '''nim c --warningAsError:Uninit:on --skipCfg --skipParentCfg $file'''
  errormsg: "use explicit initialization of 'x' for clarity [Uninit]"
  line: 24
  disabled: "true"
"""

proc gah[T](x: out T) =
  x = 3

proc main =
  var a: array[2, int]
  var x: int
  gah(x)
  a[0] = 3
  a[x] = 3
  echo x

main()

proc mainB =
  var a: array[2, int]
  var x: int
  a[0] = 3
  a[x] = 3
  echo x

mainB()