-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes move sideeffects issues [backport] (#22439)
* fixes move sideeffects issues [backport] * fix openarray * fixes openarray
- Loading branch information
Showing
2 changed files
with
33 additions
and
3 deletions.
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,18 @@ | ||
discard """ | ||
targets: "c cpp" | ||
""" | ||
|
||
block: | ||
var called = 0 | ||
|
||
proc bar(a: var int): var int = | ||
inc called | ||
result = a | ||
|
||
proc foo = | ||
var a = 2 | ||
var s = move bar(a) | ||
doAssert called == 1 | ||
doAssert s == 2 | ||
|
||
foo() |