diff options
author | chriseth <c@ethdev.com> | 2015-08-06 21:33:06 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-08-07 23:50:07 +0800 |
commit | ab33328d1f6d9e76d5294bb30785adb86e7175a5 (patch) | |
tree | beb93dfeb1b8f043644a939fd99bce861f37621d | |
parent | 666062cf07ead8166daaf82df2abbaa8d88038d7 (diff) | |
download | dexon-solidity-ab33328d1f6d9e76d5294bb30785adb86e7175a5.tar dexon-solidity-ab33328d1f6d9e76d5294bb30785adb86e7175a5.tar.gz dexon-solidity-ab33328d1f6d9e76d5294bb30785adb86e7175a5.tar.bz2 dexon-solidity-ab33328d1f6d9e76d5294bb30785adb86e7175a5.tar.lz dexon-solidity-ab33328d1f6d9e76d5294bb30785adb86e7175a5.tar.xz dexon-solidity-ab33328d1f6d9e76d5294bb30785adb86e7175a5.tar.zst dexon-solidity-ab33328d1f6d9e76d5294bb30785adb86e7175a5.zip |
Do not allow boolean operators for integers.
Fixes #2496
-rw-r--r-- | Token.h | 1 | ||||
-rw-r--r-- | Types.cpp | 2 |
2 files changed, 3 insertions, 0 deletions
@@ -366,6 +366,7 @@ public: } static bool isBitOp(Value op) { return (BitOr <= op && op <= SHR) || op == BitNot; } + static bool isBooleanOp(Value op) { return (Or <= op && op <= And) || op == Not; } static bool isUnaryOp(Value op) { return (Not <= op && op <= Delete) || op == Add || op == Sub || op == After; } static bool isCountOp(Value op) { return op == Inc || op == Dec; } static bool isShiftOp(Value op) { return (SHL <= op) && (op <= SHR); } @@ -311,6 +311,8 @@ TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointe // All integer types can be compared if (Token::isCompareOp(_operator)) return commonType; + if (Token::isBooleanOp(_operator)) + return TypePointer(); // Nothing else can be done with addresses if (commonType->isAddress()) return TypePointer(); |