diff --git a/cps/transform.nim b/cps/transform.nim index 83d665b7..8f300ca9 100644 --- a/cps/transform.nim +++ b/cps/transform.nim @@ -1095,8 +1095,12 @@ macro cpsHandleUnhandledException(contType: typed; n: typed): untyped = body except: cont.ex = getCurrentException() - return Continuation: unwind(contType(cont), cont.ex) - + # A continuation body created with makeContProc (which is all of + # them) will have a terminator in the body, thus this part can + # only be reached iff the except branch happened to deter the jump + # + # Workaround for https://github.com/nim-lang/Nim/issues/18411 + return Continuation: unwind(contType(cont), cont.ex) result = fnDef debugAnnotation cpsHandleUnhandledException, n: