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

Cannot return a type with copy forbidden #190

Open
alaviss opened this issue Jun 27, 2021 · 0 comments
Open

Cannot return a type with copy forbidden #190

alaviss opened this issue Jun 27, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@alaviss
Copy link
Contributor

alaviss commented Jun 27, 2021

import cps

type
  O = object

proc `=copy`(dst: var O, src: O) {.error.}

proc foo(): O {.cps: Continuation.} =
  result = O()

discard foo()

got:

test.nim(8, 1) Error: '=copy' is not available for type <O>; requires a copy because it's not the last read of 'cps environment(c_436207858).result'; routine: foo

We need a version of () that can consume the result.

@alaviss alaviss added the bug Something isn't working label Jun 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant