mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
* fixes #21995: align C with C++ backend behavior for empty raise statements * make runtime behavior match across both C and C++ backend and all exception modes
This commit is contained in:
@@ -779,11 +779,7 @@ proc genRaiseStmt(p: BProc, t: PNode) =
|
||||
else:
|
||||
finallyActions(p)
|
||||
genLineDir(p, t)
|
||||
# reraise the last exception:
|
||||
if p.config.exc == excCpp:
|
||||
line(p, cpsStmts, "throw;\n")
|
||||
else:
|
||||
linefmt(p, cpsStmts, "#reraiseException();$n", [])
|
||||
linefmt(p, cpsStmts, "#reraiseException();$n", [])
|
||||
raiseInstr(p, p.s(cpsStmts))
|
||||
|
||||
template genCaseGenericBranch(p: BProc, b: PNode, e: TLoc,
|
||||
|
||||
9
tests/ccgbugs/t21995.nim
Normal file
9
tests/ccgbugs/t21995.nim
Normal file
@@ -0,0 +1,9 @@
|
||||
discard """
|
||||
targets: "c cpp"
|
||||
output: "Hi!"
|
||||
"""
|
||||
|
||||
try:
|
||||
raise
|
||||
except:
|
||||
echo "Hi!"
|
||||
Reference in New Issue
Block a user