2018-05-04 13:58:24 +00:00
|
|
|
contract C {
|
|
|
|
struct S { bool f; }
|
|
|
|
S s;
|
|
|
|
function f() internal returns (S storage c) {
|
|
|
|
assembly {
|
|
|
|
sstore(c_slot, sload(s_slot))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function g(bool flag) internal returns (S storage c) {
|
|
|
|
// control flow in assembly will not be analyzed for now,
|
2018-08-02 16:55:06 +00:00
|
|
|
// so this will not issue an error
|
2018-05-04 13:58:24 +00:00
|
|
|
assembly {
|
|
|
|
if flag {
|
|
|
|
sstore(c_slot, sload(s_slot))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function h() internal returns (S storage c) {
|
|
|
|
// any reference from assembly will be sufficient for now,
|
2018-08-02 16:55:06 +00:00
|
|
|
// so this will not issue an error
|
2018-05-04 13:58:24 +00:00
|
|
|
assembly {
|
|
|
|
sstore(s_slot, sload(c_slot))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ----
|