summary refs log blame commit diff stats
path: root/tests/ccgbugs/t6756.nim
blob: 5170a99f4ccabd3ae78df24576d6c0a0ff0dbb32 (plain) (tree)
1
2
3
4
5
6





           

















                                            
discard """
output: '''
(v: 3)
'''
"""

import typetraits
type
  A[T] = ref object
    v: T

template templ(o: A, op: untyped): untyped =
  type T = type(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)[]