fix #19349 incompatible type when mixing float32 and cfloat in generics (#20551)

This commit is contained in:
Bung 2022-10-21 15:28:18 +08:00 • committed by GitHub
commit 84fab7f39b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

19
tests/alias/t19349.nim Normal file
View file

@ -0,0 +1,19 @@
discard """
action: "compile"
"""
type
Vec3[T: SomeNumber] = object
arr: array[3, T]
var
cfloatArr: array[3, array[3, cfloat]]
cfloatSeq = newSeq[Vec3[cfloat]]()
for row in cfloatArr:
cfloatSeq.add(Vec3[float32](arr: [row[0], row[1], row[2]]))
var
cuintArr: array[3, array[3, cuint]]
cuintSeq = newSeq[Vec3[cuint]]()
for row in cuintArr:
cuintSeq.add(Vec3[uint32](arr: [row[0], row[1], row[2]]))