diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-01-04 03:10:09 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-01-04 03:10:09 +0100 |
commit | 3d7c57db8812e6cf7bf1e48d074d3c1a986ede4e (patch) | |
tree | dbe4a02146fa6352f355bcb2c62584cf7c76c238 /tests/ccgbugs | |
parent | 91e9cb64e9a7b4c46b07ef2a4302cf2cc5295435 (diff) | |
download | Nim-3d7c57db8812e6cf7bf1e48d074d3c1a986ede4e.tar.gz |
fixes #2659
Diffstat (limited to 'tests/ccgbugs')
-rw-r--r-- | tests/ccgbugs/tgeneric_closure.nim | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ccgbugs/tgeneric_closure.nim b/tests/ccgbugs/tgeneric_closure.nim new file mode 100644 index 000000000..f9d5e7910 --- /dev/null +++ b/tests/ccgbugs/tgeneric_closure.nim @@ -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 |