solidity/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol
2020-04-28 16:03:52 +05:30

13 lines
537 B
Solidity

contract C {
function f(address a) external view returns (bool success) {
(success,) = a.call{value: 42}("");
}
function h() external payable {}
function i() external view {
this.h{value: 42}();
}
}
// ----
// TypeError: (90-111): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
// TypeError: (182-201): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.