mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allow explicit conversion from address to address payable
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
contract C {
|
||||
function g(address payable _p) internal pure returns (uint) {
|
||||
return 1;
|
||||
}
|
||||
function f(address _a) public pure {
|
||||
uint x = g(payable(_a));
|
||||
uint y = g(_a);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (169-171): Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public view {
|
||||
address payable p = payable(msg.sender);
|
||||
address payable q = payable(address(msg.sender));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (43-60): Unused local variable.
|
||||
// Warning: (86-103): Unused local variable.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
address payable p = payable(this);
|
||||
address payable q = payable(address(this));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (63-76): Explicit type conversion not allowed from "contract C" to "address payable".
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
address payable q = payable;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError: (70-71): Expected '(' but got ';'
|
||||
Reference in New Issue
Block a user