mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Detect duplicate cases based on integer value of case label.
This commit is contained in:
@@ -436,7 +436,7 @@ bool AsmAnalyzer::operator()(Switch const& _switch)
|
||||
);
|
||||
}
|
||||
|
||||
set<Literal const*, Less<Literal*>> cases;
|
||||
set<u256> cases;
|
||||
for (auto const& _case: _switch.cases)
|
||||
{
|
||||
if (_case.value)
|
||||
@@ -450,7 +450,7 @@ bool AsmAnalyzer::operator()(Switch const& _switch)
|
||||
m_stackHeight--;
|
||||
|
||||
/// Note: the parser ensures there is only one default case
|
||||
if (!cases.insert(_case.value.get()).second)
|
||||
if (!cases.insert(valueOfLiteral(*_case.value)).second)
|
||||
{
|
||||
m_errorReporter.declarationError(
|
||||
_case.location,
|
||||
|
||||
Reference in New Issue
Block a user