My npm installation provides Solc version 0.7.0. Creating a Struct with a mapping inside emits the message: "Struct containing a (nested) mapping cannot be constructed."
Here is the code to look at:
// SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
contract Store {
struct Submission {
uint256 amount;
mapping(address => bool) votes;
}
Submission[] public submissions;
...
function addSubmission(
uint256 amount
) public {
Submission memory fresh = Submission({ // compiler reports the error here
amount: amount
});
submissions.push(fresh);
}
}
With earlier solc versions, this same code builds successfully.
Thanks for taking a look!