summary refs log tree commit diff stats
path: root/tests/vm/tnocompiletimefunc.nim
blob: a95648c0ffe91b58440e8aa28f3cad529976be5d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
discard """
  errormsg: "request to generate code for .compileTime proc: foo"
"""

# ensure compileTime funcs can't be called from runtime

func foo(a: int): int {.compileTime.} =
  a * a

proc doAThing(): int =
  for i in 0..2:
    result += foo(i)

echo doAThing()