Disallow implicit conversion from rational (literal) to address

This commit is contained in:
Jason Cobb
2018-06-25 16:17:50 +02:00
committed by Alex Beregszaszi
parent b7003505c4
commit 3d88eca531
+4 -2
View File
@@ -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))
{