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

destructible context without 'result' or 'return' should also be supported #1192

Amselchen opened this issue May 11, 2014 · 1 comment


None yet
2 participants
Copy link

commented May 11, 2014

  TFoo = object
    bar: TBar

  TBar = object
    x: string

proc delete (a: var TBar) {.destructor.} =
  echo "delete TBar"

proc delete (a: var TFoo) {.destructor.} =
  echo "delete TFoo"

proc createBar (): TBar =
  return TBar(x: "TBar")

proc createFoo (): TFoo =
  #return TFoo(bar: createBar()) # works
  #result = TFoo(bar: createBar()) # works too
  TFoo(bar: createBar()) # does not work                   <<<<<<<<<<<<

proc main () =
  var a = createFoo()

  echo "" & $a

# start

This comment has been minimized.

Copy link

commented Apr 22, 2018

Destructible contexts are gone for destructors.

@Araq Araq closed this Apr 22, 2018

Araq added a commit that referenced this issue Apr 23, 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.