I'd like to digest a data structure (a struct) with keccak256, but solc (0.4.23) tells me "Error: This type cannot be encoded."
Is there a good reason why can't solidity encode the struct? That looks like a straightforward job to me.
My current workaround is to manually call abi.encodePacked with each individual element of the structure, plus (as a header) a constant that lets me distinguish easily between different data structures. It's syntactically more cumbersome, and is not as type-safe as if I could hash the struct directly, but it does the job. Is that the right thing to do?