diff options
Diffstat (limited to 'tests/ccgbugs/t6756.nim')
-rw-r--r-- | tests/ccgbugs/t6756.nim | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ccgbugs/t6756.nim b/tests/ccgbugs/t6756.nim new file mode 100644 index 000000000..5990eba58 --- /dev/null +++ b/tests/ccgbugs/t6756.nim @@ -0,0 +1,24 @@ +discard """ +output: ''' +(v: 3) +''' +""" + +import typetraits +type + A[T] = ref object + v: T + +template templ(o: A, op: untyped): untyped = + type T = typeof(o.v) + + var res: A[T] + + block: + var it {.inject.}: T + it = o.v + res = A[T](v: op) + res + +let a = A[int](v: 1) +echo templ(a, it + 2)[] |