From dddfbcf211cd46453b78a9d207347a158311f85e Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Tue, 12 May 2020 10:19:31 -0700 Subject: [PATCH] close #13071 by adding test: nim cpp -r --gc:arc` segfaults on caught AssertionError (#14323) --- tests/arc/texceptions.nim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/arc/texceptions.nim diff --git a/tests/arc/texceptions.nim b/tests/arc/texceptions.nim new file mode 100644 index 0000000000..c55b463fc9 --- /dev/null +++ b/tests/arc/texceptions.nim @@ -0,0 +1,16 @@ +discard """ + cmd: "nim cpp --gc:arc $file" +""" + +block: # issue #13071 + type MyExcept = object of CatchableError + proc gun()= + raise newException(MyExcept, "foo:") + proc fun()= + var a = "" + try: + gun() + except Exception as e: + a = e.msg & $e.name # was segfaulting here for `nim cpp --gc:arc` + doAssert a == "foo:MyExcept" + fun()