diff options
author | Jason Cobb <jason.e.cobb@gmail.com> | 2018-02-16 12:23:27 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-06-25 22:17:50 +0800 |
commit | 3d88eca531109b8b19eabd9f33b9d860056e7754 (patch) | |
tree | 3fab3e5b9adb99d1b524dc09001221bcca86f17d /libsolidity | |
parent | b7003505c46942ca2ee4e5317d14f421d5b9bc6d (diff) | |
download | dexon-solidity-3d88eca531109b8b19eabd9f33b9d860056e7754.tar dexon-solidity-3d88eca531109b8b19eabd9f33b9d860056e7754.tar.gz dexon-solidity-3d88eca531109b8b19eabd9f33b9d860056e7754.tar.bz2 dexon-solidity-3d88eca531109b8b19eabd9f33b9d860056e7754.tar.lz dexon-solidity-3d88eca531109b8b19eabd9f33b9d860056e7754.tar.xz dexon-solidity-3d88eca531109b8b19eabd9f33b9d860056e7754.tar.zst dexon-solidity-3d88eca531109b8b19eabd9f33b9d860056e7754.zip |
Disallow implicit conversion from rational (literal) to address
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/ast/Types.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index c4d97c64..68c53af1 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -858,11 +858,13 @@ bool RationalNumberType::isImplicitlyConvertibleTo(Type const& _convertTo) const { if (_convertTo.category() == Category::Integer) { - if (m_value == rational(0)) - return true; if (isFractional()) return false; IntegerType const& targetType = dynamic_cast<IntegerType const&>(_convertTo); + if (targetType.isAddress()) + return false; + if (m_value == rational(0)) + return true; unsigned forSignBit = (targetType.isSigned() ? 1 : 0); if (m_value > rational(0)) { |