Mercurial > projects > ldc
comparison dmd/expression.c @ 1616:c94049033c20
Merge DMD r296: bugzilla 3617 CTFE: wrong code for if(x) where x is int...
bugzilla 3617 CTFE: wrong code for if(x) where x is int or smaller.
---
dmd/expression.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
author | Leandro Lucarella <llucax@gmail.com> |
---|---|
date | Wed, 06 Jan 2010 15:18:21 -0300 |
parents | 081c48283153 |
children | a87f1d6ff48e |
comparison
equal
deleted
inserted
replaced
1615:3da302cc4966 | 1616:c94049033c20 |
---|---|
1510 return toReal(); | 1510 return toReal(); |
1511 } | 1511 } |
1512 | 1512 |
1513 int IntegerExp::isBool(int result) | 1513 int IntegerExp::isBool(int result) |
1514 { | 1514 { |
1515 return result ? value != 0 : value == 0; | 1515 int r = toInteger() != 0; |
1516 return result ? r : !r; | |
1516 } | 1517 } |
1517 | 1518 |
1518 Expression *IntegerExp::semantic(Scope *sc) | 1519 Expression *IntegerExp::semantic(Scope *sc) |
1519 { | 1520 { |
1520 if (!type) | 1521 if (!type) |