diff --git a/src/test/01-Basic/228-dangle-ref-recurse.ck b/src/test/01-Basic/228-dangle-ref-recurse.ck new file mode 100644 index 000000000..205f66fa6 --- /dev/null +++ b/src/test/01-Basic/228-dangle-ref-recurse.ck @@ -0,0 +1,22 @@ +// test dangling object cleanup on recursive functions that return Objects + +// test object +Object foo; + +// a recrusive function +fun Object get( int i ) +{ + // stop recursion + if( i == 10 ) return foo; + // calls + get(i+1), get(i+1), get(i+1); + // another call + return get(i+1); +} + +// get started +get(0); + +// check +if( Machine.refcount(foo) == 1 ) <<< "success" >>>; +