cereal
cereal copied to clipboard
narrowing error on arm64
In Debian, we run the unit tests post-installation.
https://salsa.debian.org/med-team/libcereal/-/blob/master/debian/tests/run-unit-test#L18
cmake -DONLY_TEST=on -DSKIP_PORTABILITY_TEST=on -DBUILD_SANDBOX=True .
make
Full log: https://ci.debian.net/data/autopkgtest/testing/arm64/libc/libcereal/32116422/log.gz using G++ 12.2.0
[ 25%] Building CXX object unittests/CMakeFiles/test_map.dir/map.cpp.o
In file included from /tmp/autopkgtest-lxc.nn60praz/downtmp/autopkgtest_tmp/unittests/map.cpp:28:
/tmp/autopkgtest-lxc.nn60praz/downtmp/autopkgtest_tmp/unittests/map.hpp: In instantiation of ‘void test_map() [with IArchive = cereal::BinaryInputArchive; OArchive = cereal::BinaryOutputArchive]’:
/tmp/autopkgtest-lxc.nn60praz/downtmp/autopkgtest_tmp/unittests/map.cpp:34:68: required from here
/tmp/autopkgtest-lxc.nn60praz/downtmp/autopkgtest_tmp/unittests/map.hpp:65:43: error: narrowing conversion of ‘random_value<char>(gen)’ from ‘std::enable_if<true, char>::type’ {aka ‘char’} to ‘signed char’ [-Werror=narrowing]
65 | o_esplmap.insert({random_value<char>(gen), { random_value<int>(gen), random_value<int>(gen) }});
| ~~~~~~~~~~~~~~~~~~^~~~~
/tmp/autopkgtest-lxc.nn60praz/downtmp/autopkgtest_tmp/unittests/map.hpp: In instantiation of ‘void test_map() [with IArchive = cereal::PortableBinaryInputArchive; OArchive = cereal::PortableBinaryOutputArchive]’:
/tmp/autopkgtest-lxc.nn60praz/downtmp/autopkgtest_tmp/unittests/map.cpp:39:84: required from here
/tmp/autopkgtest-lxc.nn60praz/downtmp/autopkgtest_tmp/unittests/map.hpp:65:43: error: narrowing conversion of ‘random_value<char>(gen)’ from ‘std::enable_if<true, char>::type’ {aka ‘char’} to ‘signed char’ [-Werror=narrowing]
/tmp/autopkgtest-lxc.nn60praz/downtmp/autopkgtest_tmp/unittests/map.hpp: In instantiation of ‘void test_map() [with IArchive = cereal::XMLInputArchive; OArchive = cereal::XMLOutputArchive]’:
/tmp/autopkgtest-lxc.nn60praz/downtmp/autopkgtest_tmp/unittests/map.cpp:44:62: required from here
/tmp/autopkgtest-lxc.nn60praz/downtmp/autopkgtest_tmp/unittests/map.hpp:65:43: error: narrowing conversion of ‘random_value<char>(gen)’ from ‘std::enable_if<true, char>::type’ {aka ‘char’} to ‘signed char’ [-Werror=narrowing]
/tmp/autopkgtest-lxc.nn60praz/downtmp/autopkgtest_tmp/unittests/map.hpp: In instantiation of ‘void test_map() [with IArchive = cereal::JSONInputArchive; OArchive = cereal::JSONOutputArchive]’:
/tmp/autopkgtest-lxc.nn60praz/downtmp/autopkgtest_tmp/unittests/map.cpp:49:64: required from here
/tmp/autopkgtest-lxc.nn60praz/downtmp/autopkgtest_tmp/unittests/map.hpp:65:43: error: narrowing conversion of ‘random_value<char>(gen)’ from ‘std::enable_if<true, char>::type’ {aka ‘char’} to ‘signed char’ [-Werror=narrowing]
cc1plus: all warnings being treated as errors
make[2]: *** [unittests/CMakeFiles/test_map.dir/build.make:76: unittests/CMakeFiles/test_map.dir/map.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:556: unittests/CMakeFiles/test_map.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
You might like to check out the patch suggested by Aaron M. Ucko
Should be fixed by https://github.com/USCiLab/cereal/pull/764 - I will try to get a new tag out in the near future after fixing various CI and merging a few more PRs.