close #13071 by adding test: nim cpp -r --gc:arc` segfaults on caught AssertionError (#14323)

This commit is contained in:
Timothee Cour 2020-05-12 10:19:31 -07:00 • committed by GitHub
commit dddfbcf211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

16
tests/arc/texceptions.nim Normal file
View file

@ -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()