mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Document legacy and IR behavior for call to zero initialized variable of function type.
This commit is contained in:
parent
311b2054af
commit
bd57de6d68
@ -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