nim-works / cps

Continuation-Passing Style for Nim 🔗

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot return a type with copy forbidden

alaviss opened this issue · comments

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.