solidity/test/libsolidity/semanticTests/various/staticcall_for_view_and_pure.sol
2020-03-26 17:47:36 +01:00

40 lines
698 B
Solidity

contract C {
uint256 x;
function f() public returns (uint256) {
x = 3;
return 1;
}
}
interface CView {
function f() external view returns (uint256);
}
interface CPure {
function f() external pure returns (uint256);
}
contract D {
function f() public returns (uint256) {
return (new C()).f();
}
function fview() public returns (uint256) {
return (CView(address(new C()))).f();
}
function fpure() public returns (uint256) {
return (CPure(address(new C()))).f();
}
}
// ====
// EVMVersion: >=byzantium
// ----
// f() -> 0x1 # This should work, next should throw #
// fview() -> FAILURE
// fpure() -> FAILURE