solang
solang copied to clipboard
Infinite recursion in emit for recursive function arguments
Describe the bug The following snip causes an infinite recursion in emit:
struct S {
int256 f1;
S[] f2;
}
// FIXME (stack overrun in emit):
function foo(S memory s) pure {}
contract Foo {
function bar() public {
S memory s = S({ f1: 1, f2: new S[](0) });
foo(s);
}
}
To Reproduce
Expected behavior
This is allowed in solc too, it should compile to a valid contract
@LucasSte found another broken example
contract Test {
struct S {
int foo;
S[] s;
}
function test(int foo) public returns (S) {
S ss = S(foo, new S[](2));
return ss;
}
}