blob: ca4a1c9ab2e097406efa8e4be44265c8f7204ed3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
// expect error: a borrowed projection cannot transfer ownership; transfer its owner
// destructors 6.15.5: a child of a value with a drop can be borrowed but not given away
include rt;
struct node { node* next; int v; void drop() { rt.put_s("drop "); rt.put_n(this.v); } }
int eat(node*.d n) { rt.put_n(n.v); return 0; }
fn main() {
node* a = rt.new(node); a.v = 1;
a.next = rt.new(node); a.next.v = 2;
eat(a.next);
return 0;
}
// zc0: skip
|