fix #20148 implicit compile time conversion int to ranged float causes compiler fatal error
This commit is contained in:
parent
534c97edc5
commit
a51ed90c5d
2 changed files with 12 additions and 1 deletions
|
|
@ -460,9 +460,12 @@ proc opConv(c: PCtx; dest: var TFullReg, src: TFullReg, desttyp, srctyp: PType):
|
|||
else: int(src.intVal != 0)
|
||||
of tyFloat..tyFloat64:
|
||||
dest.ensureKind(rkFloat)
|
||||
case skipTypes(srctyp, abstractRange).kind
|
||||
let srcKind = skipTypes(srctyp, abstractRange).kind
|
||||
case srcKind
|
||||
of tyInt..tyInt64, tyUInt..tyUInt64, tyEnum, tyBool, tyChar:
|
||||
dest.floatVal = toBiggestFloat(src.intVal)
|
||||
elif src.kind == rkInt:
|
||||
dest.floatVal = toBiggestFloat(src.intVal)
|
||||
else:
|
||||
dest.floatVal = src.floatVal
|
||||
of tyObject:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue