My version of solc:
"solc": "^0.7.1",
When I try to construct a struct that contains mapping, I got this error: "Struct containing a (nested) mapping cannot be constructed"
This is my solidity code.
Campaign.sol
pragma solidity >=0.5.0;
contract Campaign {
struct Request {
string description;
// I declared a mapping inside of a struct.
mapping(address => bool) approvals;
}
constructor(uint256 minimum, address creator) {
...
}
function createRequest(string memory description) public onlyManager {
Request memory newRequest = Request({
// Here the compiler gives me an error
description : description
});
}
...
It says
Struct containing a (nested) mapping cannot be constructed.
Please help me.
solidity version 7.0
, whenpush
was used