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

20 lines
365 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();
}
}
// ----
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
// gas legacy: 101790