mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #5061 from ethereum/fixedSizeArrayLength
Disallow fixed-size arrays with zero length
This commit is contained in:
@@ -246,6 +246,8 @@ void ReferencesResolver::endVisit(ArrayTypeName const& _typeName)
|
||||
RationalNumberType const* lengthType = dynamic_cast<RationalNumberType const*>(lengthTypeGeneric.get());
|
||||
if (!lengthType || !lengthType->mobileType())
|
||||
fatalTypeError(length->location(), "Invalid array length, expected integer literal or constant expression.");
|
||||
else if (lengthType->isZero())
|
||||
fatalTypeError(length->location(), "Array with zero length specified.");
|
||||
else if (lengthType->isFractional())
|
||||
fatalTypeError(length->location(), "Array with fractional length specified.");
|
||||
else if (lengthType->isNegative())
|
||||
|
||||
Reference in New Issue
Block a user