mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7496 from ethereum/arraysOfRecursiveStructs
Fix internal compiler error for arrays of recursive structs.
This commit is contained in:
commit
641c06d50d
@ -16,6 +16,7 @@ Bugfixes:
|
||||
* Code Generator: Fix internal error when popping a dynamic storage array of mappings.
|
||||
* Name Resolver: Fix wrong source location when warning on shadowed aliases in import declarations.
|
||||
* Scanner: Fix multi-line natspec comment parsing with triple slashes when file is encoded with CRLF instead of LF.
|
||||
* Type System: Fix arrays of recursive structs.
|
||||
* Yul Optimizer: Fix reordering bug in connection with shifted one and mul/div-instructions in for loop conditions.
|
||||
|
||||
|
||||
|
@ -2050,6 +2050,8 @@ unsigned StructType::calldataOffsetOfMember(std::string const& _member) const
|
||||
|
||||
bool StructType::isDynamicallyEncoded() const
|
||||
{
|
||||
if (recursive())
|
||||
return true;
|
||||
solAssert(interfaceType(false).get(), "");
|
||||
for (auto t: memoryMemberTypes())
|
||||
{
|
||||
|
@ -0,0 +1,12 @@
|
||||
contract Test {
|
||||
struct RecursiveStruct {
|
||||
RecursiveStruct[] vals;
|
||||
}
|
||||
|
||||
function func() public pure {
|
||||
RecursiveStruct[1] memory val = [ RecursiveStruct(new RecursiveStruct[](42)) ];
|
||||
assert(val[0].vals.length == 42);
|
||||
}
|
||||
}
|
||||
// -----
|
||||
// func() ->
|
@ -0,0 +1,10 @@
|
||||
contract Test {
|
||||
struct RecursiveStruct {
|
||||
RecursiveStruct[] vals;
|
||||
}
|
||||
|
||||
function func() private pure {
|
||||
RecursiveStruct[1] memory val;
|
||||
val;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user