solidity/test/libsolidity/syntaxTests/constructor/msg_value_non_payable.sol
2022-04-01 23:41:18 -05:00

9 lines
259 B
Solidity

contract C {
uint256 value;
constructor() {
value = msg.value;
}
}
// ----
// TypeError 5887: (68-77='msg.value'): "msg.value" and "callvalue()" can only be used in payable constructors. Make the constructor "payable" to avoid this error.