forked from nim-lang/Nim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix nim-lang#13902 distinct uint64 type corruption on 32-bit with borrow
- Loading branch information
Timothee Cour
committed
Apr 7, 2020
1 parent
92c4aad
commit 5535a33
Showing
2 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
discard """ | ||
cmd: "nim c -r --skipParentCfg --skipUserCfg --cpu:i386 --passC:-m32 --passL:-m32 --stacktrace:off --hints:off $file" | ||
action: run | ||
""" | ||
|
||
#issue #13902 | ||
when defined(linux): | ||
block: | ||
type Slot = distinct uint64 | ||
var s = Slot(1) | ||
proc `$`(x: Slot): string {.borrow.} | ||
proc `+=`(x: var Slot, y: uint64) {.borrow.} | ||
echo "s = ", s | ||
s += 1 | ||
echo "s = ", s | ||
doAssert s.uint64 == 2, $s # was failing, showing 18419607611339964418 |