summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-05-12 10:19:31 -0700
committerGitHub <noreply@github.com>2020-05-12 19:19:31 +0200
commitdddfbcf211cd46453b78a9d207347a158311f85e (patch)
treed455b3e4eff3e97cdfdb9f2141e22ee03b31f5b2
parentde74362213baeb28d52c05c71cd9b8389ae69060 (diff)
downloadNim-dddfbcf211cd46453b78a9d207347a158311f85e.tar.gz
close #13071 by adding test: nim cpp -r --gc:arc` segfaults on caught AssertionError (#14323)
-rw-r--r--tests/arc/texceptions.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/arc/texceptions.nim b/tests/arc/texceptions.nim
new file mode 100644
index 000000000..c55b463fc
--- /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()