solidity/test/libsolidity/semanticTests/immutable/external_function_pointer.sol
2020-03-24 16:45:25 +01:00

21 lines
412 B
Solidity

contract D {
function f() external view returns (uint256) {
return 42;
}
}
contract C {
D d;
function() external view returns(uint256) immutable z;
constructor() public {
d = new D();
z = d.f;
}
function f() public view returns (uint256) {
assert(z.address == address(d));
assert(z.selector == D.f.selector);
return z();
}
}
// ----
// f() -> 42