solidity/test/libsolidity/semanticTests/structs/struct_delete_struct_in_mapping.sol

21 lines
363 B
Solidity
Raw Normal View History

contract test {
struct testStruct {
uint256 m_value;
}
mapping(uint256 => testStruct) campaigns;
2020-06-23 12:14:24 +00:00
constructor() {
campaigns[0].m_value = 2;
}
function deleteIt() public returns (uint256) {
delete campaigns[0];
return campaigns[0].m_value;
}
}
// ====
// compileViaYul: also
// ----
// deleteIt() -> 0