parent
6d7d1e60fe
commit
b18307f940
2 changed files with 18 additions and 1 deletions
|
|
@ -415,7 +415,8 @@ proc opConv(c: PCtx; dest: var TFullReg, src: TFullReg, desttyp, srctyp: PType):
|
||||||
else:
|
else:
|
||||||
internalError(c.config, "cannot convert to string " & desttyp.typeToString)
|
internalError(c.config, "cannot convert to string " & desttyp.typeToString)
|
||||||
else:
|
else:
|
||||||
case skipTypes(desttyp, abstractVarRange).kind
|
let desttyp = skipTypes(desttyp, abstractVarRange)
|
||||||
|
case desttyp.kind
|
||||||
of tyInt..tyInt64:
|
of tyInt..tyInt64:
|
||||||
dest.ensureKind(rkInt)
|
dest.ensureKind(rkInt)
|
||||||
case skipTypes(srctyp, abstractRange).kind
|
case skipTypes(srctyp, abstractRange).kind
|
||||||
|
|
|
||||||
|
|
@ -79,3 +79,19 @@ except RangeDefect:
|
||||||
success = true
|
success = true
|
||||||
|
|
||||||
doAssert success, "conversion should fail at runtime"
|
doAssert success, "conversion should fail at runtime"
|
||||||
|
|
||||||
|
template main() =
|
||||||
|
# xxx move all tests under here so it gets tested in CT and RT
|
||||||
|
block: # bug #17572
|
||||||
|
type T = distinct uint64
|
||||||
|
func f(x: uint64): auto =
|
||||||
|
let a = T(x)
|
||||||
|
(x, a.uint64)
|
||||||
|
const x = 1'u64 shl 63 or 7
|
||||||
|
const b = T(x)
|
||||||
|
doAssert b.uint64 == 9223372036854775815'u64
|
||||||
|
doAssert $b.uint64 == "9223372036854775815"
|
||||||
|
doAssert f(x) == (9223372036854775815'u64, 9223372036854775815'u64)
|
||||||
|
|
||||||
|
static: main()
|
||||||
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue