aboutsummaryrefslogtreecommitdiff
path: root/tests/errors/leak_overwrite.zc
blob: 45febed2f03f898c4f9c4e3065f6edf4b3b98d08 (plain) (blame)
1
2
3
4
5
6
7
namespace;
include rt;

// a u object still has to leave its block, so overwriting it is not a free (spec 6.8.5)
// expect: x: still owns an object
int*.u mk() { int*.u x = rt.new(1); x = rt.new(2); return x; }
fn main() { let p = mk(); return p[0]; }