mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Warns if modifier uses msg.value in non-payable function.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
modifier m(uint _amount, uint _avail) { require(_avail >= _amount); _; }
|
||||
function f() m(1 ether, msg.value) public pure {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (118-127): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
||||
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
modifier m(uint _amount, uint _avail) { require(_avail >= _amount); _; }
|
||||
function f() m(1 ether, msg.value) public view {}
|
||||
}
|
||||
// ----
|
||||
// Warning: (118-127): "msg.value" used in non-payable function. Do you want to add the "payable" modifier to this function?
|
||||
Reference in New Issue
Block a user