Skip to content

Commit 49a878b

Browse files
fixup! Allow constants in custom storage layout expression
1 parent 059349f commit 49a878b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: libsolidity/analysis/PostTypeContractLevelChecker.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ void PostTypeContractLevelChecker::checkStorageLayoutSpecifier(ContractDefinitio
118118
rational baseSlotRationalValue;
119119
if (auto const integerType = dynamic_cast<IntegerType const*>(baseSlotExpressionType))
120120
{
121+
if (integerType->isSigned())
122+
{
123+
m_errorReporter.typeError(
124+
1481_error,
125+
baseSlotExpression.location(),
126+
"The base slot expression must be a constant unsigned integer value."
127+
);
128+
return;
129+
}
121130
std::optional<ConstantEvaluator::TypedRational> typedRational = ConstantEvaluator::evaluate(m_errorReporter, baseSlotExpression);
122131
if (!typedRational)
123132
{

0 commit comments

Comments
 (0)