summary refs log blame commit diff stats
path: root/tests/vm/twrongarray.nim
blob: 7f24290e2071f297466ca105781c7274f9d616ed (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                                      
                                          
discard """
  errormsg: "cannot evaluate at compile time: size"
  line: 16
"""

#bug #1343

when false:
  proc one(dummy: int, size: int) =
    var x: array[size, int] # compile error: constant expression expected

  proc three(size: int) =
    var x: array[size * 1, int] # compile error: cannot evaluate at compile time: size

proc two(dummy: int, size: int) =
  var x: array[size * 1, int] # compiles, but shouldn't?
  # doAssert(x.len == size) # just for fun