solidity/test/libsolidity/semanticTests/arithmetics/check_var_init.sol
2020-10-19 16:58:59 +02:00

19 lines
322 B
Solidity

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();
}
}
// ----
// f() -> FAILURE
// g(), 100 wei -> 1