diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-04-08 00:56:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-08 09:56:16 +0200 |
commit | 95fd8ae93ce8732eb5a979d4cd63e0350594318d (patch) | |
tree | 1a8d717554343e4bd962fb26340cbf6915c1a9b1 /tests/ccgbugs | |
parent | 3036ec9c4456f6a5edb0a5bbfbb3e3c79fba7d23 (diff) | |
download | Nim-95fd8ae93ce8732eb5a979d4cd63e0350594318d.tar.gz |
fix #13902 distinct uint64 type corruption on 32-bit with borrow (#13907) [backport:1.2]
* fix #13902 distinct uint64 type corruption on 32-bit with borrow Co-authored-by: Timothee Cour <timothee.cour2+lightsail@gmail.com>
Diffstat (limited to 'tests/ccgbugs')
-rw-r--r-- | tests/ccgbugs/t13902.nim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ccgbugs/t13902.nim b/tests/ccgbugs/t13902.nim new file mode 100644 index 000000000..fd4f76d15 --- /dev/null +++ b/tests/ccgbugs/t13902.nim @@ -0,0 +1,12 @@ + +#issue #13902 +block: + type Slot = distinct uint64 + var s = Slot(1) + proc `$`(x: Slot): string {.borrow.} + proc `+=`(x: var Slot, y: uint64) {.borrow.} + # test was failing with either 0 or 2 echos but not with 1 echo + # echo "s = ", s + s += 1 + # echo "s = ", s + doAssert s.uint64 == 2, $s # was failing, showing 18419607611339964418 |