1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- discard """
- cmd: '''nim c --newruntime $file'''
- output: '''OK 3
- 5 1'''
- """
- import strutils, math
- import system / ansi_c
- import core / allocators
- proc mainA =
- try:
- var e: owned(ref ValueError)
- new(e)
- e.msg = "message"
- raise e
- except Exception as e:
- raise
- proc main =
- raise newException(ValueError, "argh")
- var ok = 0
- try:
- mainA()
- except ValueError:
- inc ok
- except:
- discard
- try:
- main()
- except ValueError:
- inc ok
- except:
- discard
- # bug #11577
- proc newError*: owned(ref Exception) {.noinline.} =
- new(result)
- proc mainC =
- raise newError()
- try:
- mainC()
- except:
- inc ok
- echo "OK ", ok
- let (a, d) = allocCounters()
- discard cprintf("%ld %ld\n", a, d)
|