Fix crash in ControlFlowGraph related to free functions.

This commit is contained in:
Mathias Baumann 2021-06-08 19:37:48 +02:00 committed by chriseth
parent e77e9e449e
commit 001a25db95
2 changed files with 17 additions and 5 deletions

View File

@ -141,11 +141,9 @@ public:
// containers using this struct
bool operator<(FunctionContractTuple const& _other) const
{
if (contract && _other.contract)
if (contract->id() != _other.contract->id())
return contract->id() < _other.contract->id();
return function->id() < _other.function->id();
return
std::make_pair(contract ? contract->id() : -1, function->id()) <
std::make_pair(_other.contract ? _other.contract->id() : -1, _other.function->id());
}
};
explicit CFG(langutil::ErrorReporter& _errorReporter): m_errorReporter(_errorReporter) {}

View File

@ -0,0 +1,14 @@
contract C0 {
function f() external {}
function f(int) external {}
function f2() external {}
}
function f() {}
contract C {
function f() external {}
}
contract C2 is C0 {}
// ----
// Warning 2519: (16-40): This declaration shadows an existing declaration.
// Warning 2519: (43-70): This declaration shadows an existing declaration.
// Warning 2519: (132-156): This declaration shadows an existing declaration.