aboutsummaryrefslogtreecommitdiff
path: root/tests/conformance/6-ownership/drop_no_move_out_field.zc
blob: e4d863c699774c8a562c77627c73fa2487656209 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
// expect error: b: can't move out of a value with drop
// destructors 6.15.5: an array that is a field of a value with a drop is part of it, so pop on it is refused too
include rt;
struct bag { int*[?] items; void drop() { rt.put_s("bag drop\n"); } }
fn main() {
	bag* b = rt.new(bag);
	b.items = rt.new(int*[?]);
	int* x = rt.new(int); *x = 5; b.items.push(x);
	int* y = b.items.pop();
	rt.put_n(*y);
	return 0;
}
// zc0: skip