solidity/test/libsolidity/semanticTests/arithmetics/checked_called_by_unchecked.sol

15 lines
404 B
Solidity
Raw Normal View History

2020-09-30 22:13:03 +00:00
contract C {
function add(uint16 a, uint16 b) public returns (uint16) {
return a + b;
}
function f(uint16 a, uint16 b, uint16 c) public returns (uint16) {
unchecked { return add(a, b) + c; }
}
}
// ====
// compileViaYul: also
// ----
2020-10-13 11:28:39 +00:00
// f(uint16,uint16,uint16): 0xe000, 0xe500, 2 -> FAILURE, hex"4e487b71", 0x11
2020-09-30 22:13:03 +00:00
// f(uint16,uint16,uint16): 0xe000, 0x1000, 0x1000 -> 0x00