2020-03-09 21:14:07 +00:00
|
|
|
contract c {
|
|
|
|
struct S {
|
|
|
|
uint16 a;
|
|
|
|
uint16 b;
|
|
|
|
uint16[3] c;
|
|
|
|
uint16[] d;
|
|
|
|
}
|
|
|
|
S[] data;
|
|
|
|
|
|
|
|
function test() public returns (uint16, uint16, uint16, uint16) {
|
|
|
|
S memory s;
|
|
|
|
s.a = 2;
|
|
|
|
s.b = 3;
|
|
|
|
s.c[2] = 4;
|
|
|
|
s.d = new uint16[](4);
|
|
|
|
s.d[2] = 5;
|
|
|
|
data.push(s);
|
|
|
|
return (data[0].a, data[0].b, data[0].c[2], data[0].d[2]);
|
|
|
|
}
|
|
|
|
}
|
2020-12-10 09:13:16 +00:00
|
|
|
// ====
|
|
|
|
// compileViaYul: also
|
2020-03-09 21:14:07 +00:00
|
|
|
// ----
|
|
|
|
// test() -> 2, 3, 4, 5
|
2021-04-12 10:53:09 +00:00
|
|
|
// gas irOptimized: 146270
|
2021-02-12 12:45:15 +00:00
|
|
|
// gas legacy: 190684
|
|
|
|
// gas legacyOptimized: 188256
|