diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 0afd93d21b0..232248ede50 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -797,6 +797,11 @@ task memory_var4(type: RunKonanTest) { source = "runtime/memory/var4.kt" } +task memory_throw_cleanup(type: RunKonanTest) { + goldValue = "Ok\n" + source = "runtime/memory/throw_cleanup.kt" +} + task unit1(type: RunKonanTest) { goldValue = "First\nkotlin.Unit\n" source = "codegen/basics/unit1.kt" diff --git a/backend.native/tests/runtime/memory/throw_cleanup.kt b/backend.native/tests/runtime/memory/throw_cleanup.kt new file mode 100644 index 00000000000..0c595b82e68 --- /dev/null +++ b/backend.native/tests/runtime/memory/throw_cleanup.kt @@ -0,0 +1,16 @@ +fun main(args: Array) { + foo(false) + try { + foo(true) + } catch (e: Error) { + println("Ok") + } +} + +fun foo(b: Boolean): Any { + var result = Any() + if (b) { + throw Error() + } + return result +} \ No newline at end of file