Fix control flow check for unary operators

This commit is contained in:
wechman
2022-09-28 13:06:20 +02:00
parent 6c4325ca03
commit 43a612e420
3 changed files with 39 additions and 3 deletions
@@ -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.