solidity/test/libsolidity/syntaxTests/viewPureChecker/builtin_functions_view_fail.sol

28 lines
1.3 KiB
Solidity
Raw Normal View History

2018-07-04 09:25:45 +00:00
contract C {
function f() view public {
address(this).transfer(1);
}
function g() view public {
require(address(this).send(2));
}
function h() view public {
selfdestruct(address(this));
}
function i() view public {
2018-08-15 21:30:09 +00:00
(bool success,) = address(this).delegatecall("");
require(success);
2018-07-04 09:25:45 +00:00
}
function j() view public {
2018-08-15 21:30:09 +00:00
(bool success,) = address(this).call("");
require(success);
2018-07-04 09:25:45 +00:00
}
receive() payable external {
}
2018-07-04 09:25:45 +00:00
}
// ----
// TypeError: (52-77): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (132-153): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (201-228): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
2018-08-15 21:30:09 +00:00
// TypeError: (293-323): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (414-436): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.