mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-01 19:02:18 +00:00
29 lines
456 B
Nim
29 lines
456 B
Nim
|
|
|
|
# bug 2659
|
|
|
|
type
|
|
GenProcType[T,U] = proc(x:T, y:var U)
|
|
IntProcType = proc(x:int, y:var int)
|
|
|
|
proc mult(x:int, y:var int) =
|
|
y = 2 * x
|
|
|
|
when isMainModule:
|
|
|
|
var input = 1
|
|
var output = 0
|
|
|
|
var someIntProc:IntProcType = mult
|
|
var someGenProc:GenProcType[int,int] = mult
|
|
|
|
mult(input, output)
|
|
echo output
|
|
|
|
someIntProc(input, output)
|
|
echo output
|
|
|
|
# Uncommenting causes an error in the C compiler.
|
|
someGenProc(input, output)
|
|
echo output
|