mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
24 lines
495 B
Solidity
24 lines
495 B
Solidity
contract test {
|
|
struct testStruct {
|
|
uint256 m_value;
|
|
}
|
|
testStruct data1;
|
|
|
|
constructor() {
|
|
data1.m_value = 2;
|
|
}
|
|
|
|
function deleteMember() public returns (uint256 ret_value) {
|
|
testStruct storage x = data1; //should not copy the data. data1.m_value == 2 but x.m_value = 0
|
|
x.m_value = 4;
|
|
delete x.m_value;
|
|
ret_value = data1.m_value;
|
|
}
|
|
}
|
|
|
|
// ====
|
|
// compileViaYul: also
|
|
// compileToEwasm: also
|
|
// ----
|
|
// deleteMember() -> 0
|