This commit is contained in:
Araq 2019-06-26 15:33:26 +02:00
commit 0a81b038fd
2 changed files with 31 additions and 12 deletions

View file

@ -806,6 +806,12 @@ proc p(n: PNode; c: var Con): PNode =
result[1][0] = p(result[1][0], c) result[1][0] = p(result[1][0], c)
of nkRaiseStmt: of nkRaiseStmt:
if optNimV2 in c.graph.config.globalOptions and n[0].kind != nkEmpty: if optNimV2 in c.graph.config.globalOptions and n[0].kind != nkEmpty:
if n[0].kind in nkCallKinds:
let call = copyNode(n[0])
recurse(n[0], call)
result = copyNode(n)
result.add call
else:
let t = n[0].typ let t = n[0].typ
let tmp = getTemp(c, t, n.info) let tmp = getTemp(c, t, n.info)
var m = genCopyNoCheck(c, t, tmp, n[0]) var m = genCopyNoCheck(c, t, tmp, n[0])

View file

@ -1,7 +1,7 @@
discard """ discard """
cmd: '''nim c --newruntime $file''' cmd: '''nim c --newruntime $file'''
output: '''OK 2 output: '''OK 3
4 1''' 5 1'''
""" """
import strutils, math import strutils, math
@ -36,6 +36,19 @@ except ValueError:
except: except:
discard discard
# bug #11577
proc newError*: owned(ref Exception) {.noinline.} =
new(result)
proc mainC =
raise newError()
try:
mainC()
except:
inc ok
echo "OK ", ok echo "OK ", ok
let (a, d) = allocCounters() let (a, d) = allocCounters()