mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
25 lines
474 B
Solidity
25 lines
474 B
Solidity
|
contract Test {
|
||
|
struct S {
|
||
|
uint8 a;
|
||
|
mapping(uint256 => uint256) b;
|
||
|
uint8 c;
|
||
|
}
|
||
|
S s;
|
||
|
|
||
|
function f() public returns (uint256) {
|
||
|
S memory x;
|
||
|
if (x.a != 0 || x.c != 0) return 1;
|
||
|
x.a = 4;
|
||
|
x.c = 5;
|
||
|
s = x;
|
||
|
if (s.a != 4 || s.c != 5) return 2;
|
||
|
x = S(2, 3);
|
||
|
if (x.a != 2 || x.c != 3) return 3;
|
||
|
x = s;
|
||
|
if (s.a != 4 || s.c != 5) return 4;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// ----
|
||
|
// f() -> 0
|