solidity/test/libsolidity/semanticTests/structs/struct_delete_member.sol
Djordje Mijovic ad8d840ee7 [Sol->Yul] Implementing conversion of struct to struct pointer.
Co-authored-by: Daniel Kirchner <daniel@ekpyron.org>
2020-10-08 16:37:57 +02:00

23 lines
471 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
// ----
// deleteMember() -> 0