Closed ripe909 closed 3 years ago
I just added a test for this issue.
But it compiles and generates no errors for me: https://github.com/Loki-Astari/ThorsSerializer/blob/master/src/Serialize/test/Issue72Test.cpp
If you can modify this file to generate the same errors as you get I will accept the pull request and I can go from there.
Or if you want to reply here with more information so I can reproduce the error.
Thanks. Well, again, this is way above my cpp skills.
It looks like the typedef for unsigned int
and signed int
is the same size as long unsigned int
and long signed int
with Newlib for arm-gcc-eabi, so "auto" can't deduce for the correct type for std::pair
I found this somewhat similar issue for another project: https://github.com/harfbuzz/harfbuzz/issues/451
This would explain why it doesn't compile for me, and it does for your compiler.
Fixing it is another matter. I tried to remove all of the templates for int
and unsigned int
but that didn't help
Try this change on line 580 of Traits.h
let me know if it fixes the issue:
auto sizeData = ....
///change to
std::initializer_list<std::pair<std::size_t, std::size_t>> sizeData =
If that does not work try: 580 of Traits.h
std::make_pair(0UL, 0UL)
/// Change to
std::make_pair(std::size_t{0}, std::size_t{0})
One of those two or both should resolve the issue.
For initializer_list<>
to work all the elements have to be the same type.
So the function call is returning: addSizeEachMemberItem()
is returning std::pair<std:size_t, std::size_t>
and make_pair()
is returning std::pair<unsigned long, unsigned long>
on most systems these would match looks like maybe your system is using unsigned int
for std::size_t
which causes the issue. So either we make the list a specific type so the compiler does not need to deduce the type or we are more explicit on the type of the initial pair in the list.
I see quite a few changes since my last pull!
Sine your last pull (which must have been more than 6 months ago) I have added support for BSON (this is a Binary Json format that is used by Mongo DB).
The advantages of BSON is that fields have a known size or are prefixed by their size (so easy to skip them). The disadvantages of BSON is that it is not very human-readable and arrays are implemented in a clunky fashion. Additionally, if you store a lot of small integers then BSON is bulkier as it always uses four bytes for an integer and is scattered with size objects that take up space (though JSON is scattered with lots of white space so win/loose).
Try this change on line
580 of Traits.h
let me know if it fixes the issue:auto sizeData = .... ///change to std::initializer_list<std::pair<std::size_t, std::size_t>> sizeData =
I tested this change and it addresses the issue. Thank You!
I will update the code and push.
Pushed an update. Closing issue.
OK, I refreshed my code from the latest master to get the Filter implementation. I see quite a few changes since my last pull!
Regardless, I am running into the following error now with a simple test case.
Using the filter test code:
I am hitting the following error:
This is way over my head, but hopefully I can get it resolved.