mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10710 from ethereum/implicit-conversion-bug
Disallow certain implicit conversions between integer types.
This commit is contained in:
@@ -510,12 +510,13 @@ BoolResult IntegerType::isImplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
if (_convertTo.category() == category())
|
||||
{
|
||||
IntegerType const& convertTo = dynamic_cast<IntegerType const&>(_convertTo);
|
||||
if (convertTo.m_bits < m_bits)
|
||||
// disallowing unsigned to signed conversion of different bits
|
||||
if (isSigned() != convertTo.isSigned())
|
||||
return false;
|
||||
else if (convertTo.m_bits < m_bits)
|
||||
return false;
|
||||
else if (isSigned())
|
||||
return convertTo.isSigned();
|
||||
else
|
||||
return !convertTo.isSigned() || convertTo.m_bits > m_bits;
|
||||
return true;
|
||||
}
|
||||
else if (_convertTo.category() == Category::FixedPoint)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user