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

21 lines
374 B
Solidity
Raw Normal View History

2020-09-30 22:13:03 +00:00
contract C {
uint public x = msg.value - 10;
constructor() payable {}
}
contract D {
function f() public {
unchecked {
new C();
}
}
function g() public payable returns (uint) {
return (new C{value: 11}()).x();
}
}
// ====
// compileViaYul: also
2020-09-30 22:13:03 +00:00
// ----
2020-10-13 11:28:39 +00:00
// f() -> FAILURE, hex"4e487b71", 0x11
2020-09-30 22:13:03 +00:00
// g(), 100 wei -> 1