From 3d88eca531109b8b19eabd9f33b9d860056e7754 Mon Sep 17 00:00:00 2001 From: Jason Cobb Date: Thu, 15 Feb 2018 23:23:27 -0500 Subject: Disallow implicit conversion from rational (literal) to address --- libsolidity/ast/Types.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libsolidity') 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(_convertTo); + if (targetType.isAddress()) + return false; + if (m_value == rational(0)) + return true; unsigned forSignBit = (targetType.isSigned() ? 1 : 0); if (m_value > rational(0)) { -- cgit