blob: 0030267f8dd16b9ead84ed3e69aa55c67d672f54 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
discard """
cmd: "nim c --newruntime $file"
errormsg: "'=' is not available for type <owned Foo>; requires a copy because it's not the last read of 'a'; another read is done here: tconsume_twice.nim(13, 10); routine: consumeTwice"
line: 11
"""
type
Foo = ref object
proc use(a: owned Foo): bool = discard
proc consumeTwice(a: owned Foo): owned Foo =
if use(a):
return
return a
assert consumeTwice(Foo()) != nil
|