solidity/test/libsolidity/semanticTests/arithmetics/check_var_init.sol
2020-10-22 19:25:55 +02:00

19 lines
343 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, hex"4e487b71", 0x11
// g(), 100 wei -> 1