diff options
-rw-r--r-- | compiler/ccgexprs.nim | 2 | ||||
-rw-r--r-- | tests/overflw/tdistinct_range.nim | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 1eb6caeb3..a3fbeca5f 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -2269,7 +2269,7 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) = initLocExpr(p, e[1], a) initLocExpr(p, e[2], b) - let ranged = skipTypes(e[1].typ, {tyGenericInst, tyAlias, tySink, tyVar, tyLent}) + let ranged = skipTypes(e[1].typ, {tyGenericInst, tyAlias, tySink, tyVar, tyLent, tyDistinct}) let res = binaryArithOverflowRaw(p, ranged, a, b, if underlying.kind == tyInt64: fun64[op] else: fun[op]) diff --git a/tests/overflw/tdistinct_range.nim b/tests/overflw/tdistinct_range.nim new file mode 100644 index 000000000..f53515d45 --- /dev/null +++ b/tests/overflw/tdistinct_range.nim @@ -0,0 +1,6 @@ +discard """ + outputsub: "Error: unhandled exception: over- or underflow [OverflowDefect]" + exitcode: "1" +""" +var x: distinct range[0..5] +dec(x) \ No newline at end of file |