-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot push to array in a struct #1491
Comments
pragma solidity ^0.8.0;
contract Foo {
struct My {
bytes bb;
}
function bar() public pure returns (uint256) {
My memory s; //declare s as a memory variable
s.bb = new bytes(0); // Initialize the bytes array
s.bb.push(0x02);
return s.bb.length;
}
}
|
Thanks @Shiva953, you are right. |
yeah sire, that's a solidity compiler limitation and I honestly don't have the slightest of the clues about anything related to compilers |
Solang does support push/pop on memory arrays, even if solc does not. However, it should not panic. |
This contract:
causes this error:
The text was updated successfully, but these errors were encountered: