mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
27 lines
708 B
Solidity
27 lines
708 B
Solidity
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,
|
|
// so this will not issue a warning
|
|
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,
|
|
// so this will not issue a warning
|
|
assembly {
|
|
sstore(s_slot, sload(c_slot))
|
|
}
|
|
}
|
|
}
|
|
// ----
|