From ce9fa80b92700a0ce36817a360d235ff024a3708 Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 24 Jun 2015 21:11:24 +0200 Subject: [PATCH] fixes #2979 --- compiler/ccgexprs.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 55fa7564ce..10b5b12512 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1582,7 +1582,8 @@ proc genRangeChck(p: BProc, n: PNode, d: var TLoc, magic: string) = var a: TLoc var dest = skipTypes(n.typ, abstractVar) # range checks for unsigned turned out to be buggy and annoying: - if optRangeCheck notin p.options or dest.kind in {tyUInt..tyUInt64}: + if optRangeCheck notin p.options or dest.skipTypes({tyRange}).kind in + {tyUInt..tyUInt64}: initLocExpr(p, n.sons[0], a) putIntoDest(p, d, n.typ, "(($1) ($2))" % [getTypeDesc(p.module, dest), rdCharLoc(a)])