fix #1013
This commit is contained in:
parent
4b7655fd10
commit
d508384d39
2 changed files with 33 additions and 4 deletions
23
tests/matrix/issue1013.nim
Normal file
23
tests/matrix/issue1013.nim
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import typetraits
|
||||
|
||||
template reject(e: expr) =
|
||||
static: assert(not compiles(e))
|
||||
|
||||
type
|
||||
TMatrix[T; M, N: static[int]] = array[M*N, T]
|
||||
|
||||
proc `*`[T; R, N, C](a: TMatrix[T, R, N], b: TMatrix[T, N, C]): TMatrix[T, R, C] =
|
||||
discard
|
||||
|
||||
var m1: TMatrix[int, 6, 4]
|
||||
var m2: TMatrix[int, 4, 3]
|
||||
var m3: TMatrix[int, 3, 3]
|
||||
|
||||
var m4 = m1*m2
|
||||
static: assert m4.M == 6 and m4.N == 3
|
||||
|
||||
reject m1 * m3 # not compatible
|
||||
|
||||
var m5 = m2 * m3
|
||||
static: assert high(m5) == 11 # 4*3 - 1
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue