solidity/test/libsolidity/smtCheckerTests/modifiers/modifier_inside_branch_assignment_branch.sol

28 lines
430 B
Solidity
Raw Normal View History

2019-04-01 09:10:28 +00:00
pragma experimental SMTChecker;
contract C {
uint x;
address owner;
modifier onlyOwner {
if (msg.sender == owner) {
require(x > 0);
_;
}
}
function f() public onlyOwner {
// Condition is always true due to `require(x > 0)` in the modifier.
if (x > 0)
x -= 1;
}
function g(uint y) public {
x = 2;
if (y > 0)
f();
assert(x > 0);
}
}
// ----
// Warning 6838: (266-271): Condition is always true.