parent
d23a757765
commit
7ad49950bd
3 changed files with 36 additions and 2 deletions
|
|
@ -29,9 +29,15 @@ proc raiseFieldError(f: string) {.compilerproc, noinline.} =
|
||||||
sysFatal(FieldDefect, f)
|
sysFatal(FieldDefect, f)
|
||||||
|
|
||||||
proc raiseRangeErrorI(i, a, b: BiggestInt) {.compilerproc, noinline.} =
|
proc raiseRangeErrorI(i, a, b: BiggestInt) {.compilerproc, noinline.} =
|
||||||
|
when defined(standalone):
|
||||||
|
sysFatal(RangeDefect, "value out of range")
|
||||||
|
else:
|
||||||
sysFatal(RangeDefect, "value out of range: " & $i & " notin " & $a & " .. " & $b)
|
sysFatal(RangeDefect, "value out of range: " & $i & " notin " & $a & " .. " & $b)
|
||||||
|
|
||||||
proc raiseRangeErrorF(i, a, b: float) {.compilerproc, noinline.} =
|
proc raiseRangeErrorF(i, a, b: float) {.compilerproc, noinline.} =
|
||||||
|
when defined(standalone):
|
||||||
|
sysFatal(RangeDefect, "value out of range")
|
||||||
|
else:
|
||||||
sysFatal(RangeDefect, "value out of range: " & $i & " notin " & $a & " .. " & $b)
|
sysFatal(RangeDefect, "value out of range: " & $i & " notin " & $a & " .. " & $b)
|
||||||
|
|
||||||
proc raiseRangeErrorU(i, a, b: uint64) {.compilerproc, noinline.} =
|
proc raiseRangeErrorU(i, a, b: uint64) {.compilerproc, noinline.} =
|
||||||
|
|
|
||||||
14
tests/gc/panicoverride.nim
Normal file
14
tests/gc/panicoverride.nim
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
proc printf(frmt: cstring) {.varargs, importc, header: "<stdio.h>", cdecl.}
|
||||||
|
proc exit(code: int) {.importc, header: "<stdlib.h>", cdecl.}
|
||||||
|
|
||||||
|
{.push stack_trace: off, profiler:off.}
|
||||||
|
|
||||||
|
proc rawoutput(s: string) =
|
||||||
|
printf("%s\n", s)
|
||||||
|
|
||||||
|
proc panic(s: string) {.noreturn.} =
|
||||||
|
rawoutput(s)
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
{.pop.}
|
||||||
14
tests/gc/tstandalone.nim
Normal file
14
tests/gc/tstandalone.nim
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
discard """
|
||||||
|
matrix: "--os:standalone --gc:none"
|
||||||
|
exitcode: 1
|
||||||
|
output: "value out of range"
|
||||||
|
"""
|
||||||
|
|
||||||
|
type
|
||||||
|
rangeType = range[0..1]
|
||||||
|
|
||||||
|
var
|
||||||
|
r: rangeType = 0
|
||||||
|
i = 2
|
||||||
|
|
||||||
|
r = rangeType(i)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue