mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow implicit conversion from rational (literal) to address
This commit is contained in:
parent
b7003505c4
commit
3d88eca531
@ -858,11 +858,13 @@ bool RationalNumberType::isImplicitlyConvertibleTo(Type const& _convertTo) const
|
|||||||
{
|
{
|
||||||
if (_convertTo.category() == Category::Integer)
|
if (_convertTo.category() == Category::Integer)
|
||||||
{
|
{
|
||||||
if (m_value == rational(0))
|
|
||||||
return true;
|
|
||||||
if (isFractional())
|
if (isFractional())
|
||||||
return false;
|
return false;
|
||||||
IntegerType const& targetType = dynamic_cast<IntegerType const&>(_convertTo);
|
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);
|
unsigned forSignBit = (targetType.isSigned() ? 1 : 0);
|
||||||
if (m_value > rational(0))
|
if (m_value > rational(0))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user