Merge pull request #12553 from ethereum/ir-ice-12546

Fix .push() not considering external functions
This commit is contained in:
Daniel Kirchner
2022-01-19 13:41:20 +01:00
committed by GitHub
3 changed files with 30 additions and 1 deletions
@@ -0,0 +1,28 @@
contract C {
struct Struct {
function () external el;
}
Struct[] array;
int externalCalled = 0;
function ext() external {
externalCalled++;
}
function f() public {
array.push(Struct(this.ext));
array.push(array[0]);
array[0].el();
array[1].el();
assert(externalCalled == 2);
}
}
// ====
// compileViaYul: also
// ----
// f() ->
// gas irOptimized: 113142
// gas legacy: 112937
// gas legacyOptimized: 112608