fixes #5285
This commit is contained in:
parent
95d8558f0c
commit
abaf5d0bdb
5 changed files with 42 additions and 6 deletions
21
tests/template/tgensymregression.nim
Normal file
21
tests/template/tgensymregression.nim
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
template mathPerComponent(op: untyped): untyped =
|
||||
proc op*[N,T](v,u: array[N,T]): array[N,T] {.inline.} =
|
||||
for i in 0 ..< len(result):
|
||||
result[i] = `*`(v[i], u[i])
|
||||
|
||||
mathPerComponent(`***`)
|
||||
# bug #5285
|
||||
when true:
|
||||
if isMainModule:
|
||||
var v1: array[3, float64]
|
||||
var v2: array[3, float64]
|
||||
echo repr(v1 *** v2)
|
||||
|
||||
|
||||
proc foo(): void =
|
||||
var v1: array[4, float64]
|
||||
var v2: array[4, float64]
|
||||
echo repr(v1 *** v2)
|
||||
|
||||
foo()
|
||||
|
|
@ -6,7 +6,7 @@ discard """
|
|||
|
||||
var i {.compileTime.} = 2
|
||||
|
||||
template defineId*(t: typedesc): stmt =
|
||||
template defineId*(t: typedesc) =
|
||||
const id {.genSym.} = i
|
||||
static: inc(i)
|
||||
proc idFor*(T: typedesc[t]): int {.inline, raises: [].} = id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue