diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-04-19 11:56:35 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-04-19 11:56:35 +0200 |
commit | 8dfdea89199012f69c844592d2abb9427b5f3041 (patch) | |
tree | 6324d29fd9f8545e9fadbbab9691df19eb92d423 /tests | |
parent | 79f64d246925c19365eb27aa4571d4cb25ede312 (diff) | |
download | Nim-8dfdea89199012f69c844592d2abb9427b5f3041.tar.gz |
fixes #4097
Diffstat (limited to 'tests')
-rw-r--r-- | tests/template/typedescids.nim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/template/typedescids.nim b/tests/template/typedescids.nim new file mode 100644 index 000000000..ebed49b17 --- /dev/null +++ b/tests/template/typedescids.nim @@ -0,0 +1,17 @@ +discard """ + output: '''2 3''' +""" + +# bug #4097 + +var i {.compileTime.} = 2 + +template defineId*(t: typedesc): stmt = + const id {.genSym.} = i + static: inc(i) + proc idFor*(T: typedesc[t]): int {.inline, raises: [].} = id + +defineId(int8) +defineId(int16) + +echo idFor(int8), " ", idFor(int16) |