Skip to content
New issue

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

Unowned ref can trivially escape without causing any crashes #11114

Closed
alaviss opened this issue Apr 25, 2019 · 0 comments
Closed

Unowned ref can trivially escape without causing any crashes #11114

alaviss opened this issue Apr 25, 2019 · 0 comments

Comments

@alaviss
Copy link
Collaborator

alaviss commented Apr 25, 2019

Example

proc test(): RootRef =
  let r: owned RootRef = RootRef()
  result = r
  # discard r # uncomment this and the code will crash on runtime (as expected)

echo test()[]

Current Output

()

Expected Output

Either stopped at compile time or

[FATAL] dangling references exist

Additional Information

Nim Compiler Version 0.19.9 [Linux: amd64]
Compiled at 2019-04-25
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: 1f7615ad9db3e8f90b20aa9932c3c11ee1793218
active boot switches: -d:release -d:useLinenoise -d:nativeStackTrace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants