Re: Nim devel branch: compiler doesn't throw an error when a variable is used after move-ing it

2020-03-03 Thread leorize
Looks like what you found was a bug in ARC :) [https://github.com/nim-lang/Nim/commit/8705ee7015382ac2957733dfef5e02a0831e7fb4](https://github.com/nim-lang/Nim/commit/8705ee7015382ac2957733dfef5e02a0831e7fb4)

Re: Nim devel branch: compiler doesn't throw an error when a variable is used after move-ing it

2020-03-03 Thread trtt
@leorize \- when I use the variable first to calculate the other thing and _then_ move it, there is no segfault. If I don't move at all there is also no segfault.

Re: Nim devel branch: compiler doesn't throw an error when a variable is used after move-ing it

2020-03-03 Thread leorize
If you do an explicit move, the variable will be cleared, so it can be reused. The segfault is an indicator of a different problem.

Nim devel branch: compiler doesn't throw an error when a variable is used after move-ing it

2020-03-03 Thread trtt
type Example* = object str: string code: int proc x0(s: string): int = s.len proc x1(b: bool): Example = var x = "abc" if b: return Example(str: move x, code: x0(x)) else: return Example(str: "...") echo x1(true) echo