cerealed
cerealed copied to clipboard
ArrayLength attribute doesn't work properly on char[] array
The following Testcase fails at runtime:
struct TestStruct {
ubyte len;
@ArrayLength("len") char[] foo;
}
auto decerealiser = Decerealiser([2, 1, 2]);
// CerealException: "@ArrayLength of 2 units of type dchar (4 bytes) larger than remaining byte array (2 bytes)"
auto ts = decerealiser.value!TestStruct;
assert(ts.foo == ['\x01', '\x02']);
assert(ts.foo.length == 2);
I think you can blame this one on auto-decoding. I suggest using ubyte instead.