-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Nim Version
2.2.4, 86bbc73
Description
In ORC, the following snippet does not compile, though it should.
In refc, the snippet does compile but copies NoCopy even though it should move it. In fact, 5 (!) copies of "test" happen on its journey to the echo.
type NoCopy = object
v: string
proc `=copy`(a: var NoCopy, b: NoCopy) {.error.}
proc sinkMe(v: sink NoCopy) =
echo v.v
proc iter(v: sink NoCopy): iterator(): int =
iterator(): int =
yield 1
sinkMe(v)
proc main() =
let vvv = iter(NoCopy(v: "test"))
for i in vvv():
echo i
main()Current Output
testit.nim(13, 12) Error: '=dup' is not available for type <sink NoCopy>, which is inferred from unavailable '=copy'; requires a copy because it's not the last read of ':envP.`:up`.v0'; routine: :anonymous
Expected Output
Known Workarounds
No response
Additional Information
No response
Metadata
Metadata
Assignees
Labels
No labels