summary refs log tree commit diff stats
path: root/tests/ccgbugs/t6756.nim
blob: 5990eba58af979fe8fcd791899503c8dbb247585 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)[]