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

`new` output can be assigned to an unowned ref #11073

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

Comments

Projects
None yet
1 participant
@alaviss
Copy link
Contributor

commented Apr 21, 2019

Example

type
  Obj = ref object

proc newObj(): Obj =
  result = new Obj
  #result = Obj() <-- this also compiles

let o = newObj()

Current Output

Compiles

Expected Output

Error out due to the fact that the unowned ref lasted longer than the owned ref.

Additional Information

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

git hash: 375b444ecd41645c848fe369a777a53f9312fbe3
active boot switches: -d:release -d:useLinenoise

@Araq Araq closed this in 665fcb1 Apr 22, 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.