1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;
/* runner.json
{
"differential": true,
"actions": [
{
"Instantiate": {
"code": {
"Solidity": {
"contract": "StructDeleteStorage"
}
}
}
},
{
"Call": {
"dest": {
"Instantiated": 0
},
"data": "e70c830d"
}
}
]
}
*/
contract StructDeleteStorage {
struct S {
uint8 a;
}
S s;
function store_and_delete() public returns (uint256 r1) {
assembly {
sstore(s.slot, 0xffffff)
}
delete s;
assembly {
r1 := sload(s.slot)
}
}
}