solidity/test/libsolidity/syntaxTests/viewPureChecker/value_with_call_nonpayable.sol
2022-04-01 23:41:18 -05:00

13 lines
509 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 8961: (90-111='a.call{value: 42}("")'): Function cannot be declared as view because this expression (potentially) modifies the state.
// TypeError 8961: (182-201='this.h{value: 42}()'): Function cannot be declared as view because this expression (potentially) modifies the state.