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

19 lines
406 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) {
unchecked {
return a + b;
}
}
function f(uint16 a) public returns (uint16) {
return add(a, 0x100) + 0x100;
}
}
// ====
// compileViaYul: also
// compileToEwasm: also
2020-09-30 22:13:03 +00:00
// ----
// f(uint16): 7 -> 0x0207
// f(uint16): 0xffff -> 511
2020-10-13 11:28:39 +00:00
// f(uint16): 0xfeff -> FAILURE, hex"4e487b71", 0x11