We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lent
This compiles even though the returned lent pointer outlives the threadvar value. Same for globals. Try -d:useMalloc for a random output.
-d:useMalloc
type Foo = ref object x: seq[int] var foo {.threadvar.}: seq[Foo] proc genfoo(): lent Foo = foo = @[Foo(x: @[1,2,3])] return foo[0] proc echoFoo() = var x = genfoo() foo[0] = nil foo.setLen 0 echo x[].x echo x[].x.len echoFoo()
Nim Compiler Version 2.3.1 [Linux: amd64] Compiled at 2025-01-18 Copyright (c) 2006-2025 by Andreas Rumpf
git hash: 2af9ddc active boot switches: -d:release
@[1, 2, 3] 23859
Compilation error (or it should copy in this case?).
No response
The text was updated successfully, but these errors were encountered:
it also occurs when returning var Foo
var Foo
Sorry, something went wrong.
No branches or pull requests
Description
This compiles even though the returned lent pointer outlives the threadvar value. Same for globals. Try
-d:useMalloc
for a random output.Nim Version
Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2025-01-18
Copyright (c) 2006-2025 by Andreas Rumpf
git hash: 2af9ddc
active boot switches: -d:release
Current Output
Expected Output
Compilation error (or it should copy in this case?).
Known Workarounds
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: