diff options
author | Araq <rumpf_a@web.de> | 2014-04-21 01:34:54 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-04-21 01:34:54 +0200 |
commit | 042ffed6c4564625021bdb1d15ac1a0e8f5b5852 (patch) | |
tree | c1102e4e3b2642dcafb0caef06d00b5a85baa64a | |
parent | 2c972427399da894f91d0a4bd067b63866bb20ea (diff) | |
download | Nim-042ffed6c4564625021bdb1d15ac1a0e8f5b5852.tar.gz |
some progress for #1082
-rw-r--r-- | compiler/semtypes.nim | 13 | ||||
-rw-r--r-- | tests/ccgbugs/tcgbug.nim | 3 |
2 files changed, 11 insertions, 5 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 384bdc8a3..6289ecc85 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -194,10 +194,15 @@ proc semRange(c: PContext, n: PNode, prev: PType): PType = if isRange(n[1]): result = semRangeAux(c, n[1], prev) let n = result.n - if n.sons[0].kind in {nkCharLit..nkUInt64Lit}: - if n.sons[0].intVal > 0 or n.sons[1].intVal < 0: - incl(result.flags, tfNeedsInit) - elif n.sons[0].floatVal > 0.0 or n.sons[1].floatVal < 0.0: + if n.sons[0].kind in {nkCharLit..nkUInt64Lit} and n.sons[0].intVal > 0: + incl(result.flags, tfNeedsInit) + elif n.sons[1].kind in {nkCharLit..nkUInt64Lit} and n.sons[1].intVal < 0: + incl(result.flags, tfNeedsInit) + elif n.sons[0].kind in {nkFloatLit..nkFloat64Lit} and + n.sons[0].floatVal > 0.0: + incl(result.flags, tfNeedsInit) + elif n.sons[1].kind in {nkFloatLit..nkFloat64Lit} and + n.sons[1].floatVal < 0.0: incl(result.flags, tfNeedsInit) else: localError(n.sons[0].info, errRangeExpected) diff --git a/tests/ccgbugs/tcgbug.nim b/tests/ccgbugs/tcgbug.nim index 535424a27..3e4755f2f 100644 --- a/tests/ccgbugs/tcgbug.nim +++ b/tests/ccgbugs/tcgbug.nim @@ -20,7 +20,8 @@ new(a) q(a) # bug #914 -var x = newWideCString("Hello") +when defined(windows): + var x = newWideCString("Hello") echo "success" |