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

alaviss opened this issue Apr 25, 2019 · 0 comments


None yet
2 participants
Copy link

commented Apr 25, 2019


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

@mratsim mratsim added the New runtime label Apr 26, 2019

@Araq Araq closed this in 1ff2b02 May 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.