mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #13569 from ethereum/document-call-to-zero-init-function-type
Document legacy and IR behavior for call to zero initialized variable of function type
This commit is contained in:
commit
7ac4c70c9b
@ -0,0 +1,27 @@
|
||||
contract Other {
|
||||
function addTwo(uint256 x) public returns (uint256) {
|
||||
return x + 2;
|
||||
}
|
||||
}
|
||||
contract C {
|
||||
function (function (uint) external returns (uint)) internal returns (uint) ev;
|
||||
function (uint) external returns (uint) x;
|
||||
|
||||
function store(function(uint) external returns (uint) y) public {
|
||||
x = y;
|
||||
}
|
||||
|
||||
function eval(function(uint) external returns (uint) y) public returns (uint) {
|
||||
return y(7);
|
||||
}
|
||||
|
||||
function t() public returns (uint256) {
|
||||
this.store((new Other()).addTwo);
|
||||
// This call panics
|
||||
return ev(x);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// t() -> FAILURE, hex"4e487b71", 0x51
|
@ -0,0 +1,27 @@
|
||||
contract Other {
|
||||
function addTwo(uint256 x) public returns (uint256) {
|
||||
return x + 2;
|
||||
}
|
||||
}
|
||||
contract C {
|
||||
function (function (uint) external returns (uint)) internal returns (uint) ev;
|
||||
function (uint) external returns (uint) x;
|
||||
|
||||
function store(function(uint) external returns (uint) y) public {
|
||||
x = y;
|
||||
}
|
||||
|
||||
function eval(function(uint) external returns (uint) y) public returns (uint) {
|
||||
return y(7);
|
||||
}
|
||||
|
||||
function t() public returns (uint256) {
|
||||
this.store((new Other()).addTwo);
|
||||
// This call panics
|
||||
return ev(x);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: false
|
||||
// ----
|
||||
// t() -> FAILURE
|
Loading…
Reference in New Issue
Block a user