From aa2d6f9632a02b7603863bf0a761552aaea02752 Mon Sep 17 00:00:00 2001 From: dimgigov Date: Thu, 11 Jun 2026 01:09:23 +0300 Subject: [PATCH] test(drop): verify auto-drop works without @[Checked] --- _test_drop_user/src/Main.bux | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 _test_drop_user/src/Main.bux diff --git a/_test_drop_user/src/Main.bux b/_test_drop_user/src/Main.bux new file mode 100644 index 0000000..f2ee678 --- /dev/null +++ b/_test_drop_user/src/Main.bux @@ -0,0 +1,15 @@ +@[Drop] +struct Buffer { + ptr: *int +} + +func Buffer_Drop(self: *Buffer) { + bux_free(self.ptr as *void); +} + +func main() -> int { + let buf: Buffer = Buffer { ptr: bux_alloc(10 as uint * sizeof(int)) as *int }; + + // Buffer should be auto-dropped here via Buffer_Drop(&buf) + return 0; +}