aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/global_transfer.zc
blob: b36ad7303c2da528154653da3fb71843fec8d0ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
namespace;
include rt;

// an m or u owner stored into a global is handed over by an automatic u transfer
let g;
let h;
int*.u make() { int* b = rt.new(int); *b = 9; return u*b; }
fn main() {
	let x = rt.new(1);
	x[0] = 5;
	g = x;
	let y = make();
	h = y;
	rt.put_n(g[0]); rt.put_c(32); rt.put_n(h[0]); rt.put_c(10);
	return 0;
}