mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix control flow check for unary operators
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
struct S { bool f; }
|
||||
|
||||
using {add as +} for S;
|
||||
|
||||
function add(S storage x, S storage) pure returns (S storage) { return x; }
|
||||
|
||||
contract C {
|
||||
S s;
|
||||
function f() public {
|
||||
S storage x = s;
|
||||
S storage y;
|
||||
x + y;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 3464: (230-231): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour.
|
||||
@@ -0,0 +1,15 @@
|
||||
struct S { int f; }
|
||||
|
||||
using {sub as -} for S;
|
||||
|
||||
function sub(S storage x) pure returns (S storage) { return x; }
|
||||
|
||||
contract C {
|
||||
function f() public {
|
||||
S storage y;
|
||||
-y;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 3464: (181-182): This variable is of storage pointer type and can be accessed without prior assignment, which would lead to undefined behaviour.
|
||||
Reference in New Issue
Block a user