fixes #2659
This commit is contained in:
parent
91e9cb64e9
commit
3d7c57db88
4 changed files with 34 additions and 3 deletions
28
tests/ccgbugs/tgeneric_closure.nim
Normal file
28
tests/ccgbugs/tgeneric_closure.nim
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
|
||||
# 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue