aboutsummaryrefslogtreecommitdiff
path: root/tests/errors/borrows_body.zc
blob: e6c92c6519ecdd40f21689c4dae52304dedb7317 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
namespace;
include rt;

// expect: first: returns a borrow of b, but its borrows clause doesn't name it
// the body is checked against the prototype's borrows clause.
char* first(char* a, char* b) borrows a;
fn main() {
	char* t = rt.new(4); t[0] = 'x'; t[1] = 0;
	char* u = rt.new(4); u[0] = 'y'; u[1] = 0;
	let r = first(t, u); rt.put_c(r[0]); rt.free(u); rt.free(t);
	return 0;
}
char* first(char* a, char* b) { return b; }