mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-24 00:05:25 +00:00
fixes #5285
This commit is contained in:
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
|
||||
|
||||
Reference in New Issue
Block a user