Disallowing shifts by signed types

This commit is contained in:
Djordje Mijovic
2020-05-26 10:18:21 +02:00
parent 69a028b49c
commit 4c3e78d046
23 changed files with 141 additions and 174 deletions
+1 -1
View File
@@ -480,7 +480,7 @@ bool isValidShiftAndAmountType(Token _operator, Type const& _shiftAmountType)
if (_operator == Token::SHR)
return false;
else if (IntegerType const* otherInt = dynamic_cast<decltype(otherInt)>(&_shiftAmountType))
return true;
return !otherInt->isSigned();
else if (RationalNumberType const* otherRat = dynamic_cast<decltype(otherRat)>(&_shiftAmountType))
return !otherRat->isFractional() && otherRat->integerType() && !otherRat->integerType()->isSigned();
else