aboutsummaryrefslogtreecommitdiff
path: root/tests/conformance/6-ownership/loop_build_list_other_owner.zc
blob: ff13262460520605e48d9985a645ce592e22f9df (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
// expect error: head: still owns an object; overwriting it would leak it
// spec 6.8.5
include rt;
struct node { int value; node* next; };
fn main() {
	node* head = rt.new(node);
	int i = 0;
	while (i < 3) {
		node* item = rt.new(node); node* other = rt.new(node); item.next = head; other.value = 1; head = other; i++;
	}
	rt.put_n(head.value);
}
// zc0: skip