mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-20 22:35:24 +00:00
fixes #3112
This commit is contained in:
@@ -1,17 +1,39 @@
|
||||
discard """
|
||||
output: '''0
|
||||
0
|
||||
2
|
||||
100'''
|
||||
"""
|
||||
|
||||
type
|
||||
RectArray*[R, C: static[int], T] = distinct array[R * C, T]
|
||||
|
||||
|
||||
StaticMatrix*[R, C: static[int], T] = object
|
||||
elements*: RectArray[R, C, T]
|
||||
|
||||
|
||||
StaticVector*[N: static[int], T] = StaticMatrix[N, 1, T]
|
||||
|
||||
|
||||
proc foo*[N, T](a: StaticVector[N, T]): T = 0.T
|
||||
proc foobar*[N, T](a, b: StaticVector[N, T]): T = 0.T
|
||||
|
||||
|
||||
|
||||
|
||||
var a: StaticVector[3, int]
|
||||
|
||||
|
||||
echo foo(a) # OK
|
||||
echo foobar(a, a) # <--- hangs compiler
|
||||
echo foobar(a, a) # <--- hangs compiler
|
||||
|
||||
# bug #3112
|
||||
|
||||
type
|
||||
Vector[N: static[int]] = array[N, float64]
|
||||
TwoVectors[Na, Nb: static[int]] = tuple
|
||||
a: Vector[Na]
|
||||
b: Vector[Nb]
|
||||
|
||||
when isMainModule:
|
||||
var v: TwoVectors[2, 100]
|
||||
echo v[0].len
|
||||
echo v[1].len
|
||||
#let xx = 50
|
||||
v[1][50] = 0.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user