cereal
cereal copied to clipboard
Clang compile error - tuple.hpp
cereal-1.3.2-r2 clang version 19.1.2 Target: x86_64-pc-linux-gnu
error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
/usr/lib/ccache/bin/clang++ -I/var/tmp/portage/dev-libs/cereal-1.3.2-r2/work/cereal-1.3.2/sandbox/sandbox_shared_lib -I/var/tmp/portage/dev-libs/cereal-1.3.2-r2/work/cereal-1.3.2/include -march=ivybridge -O2 -pipe -flto=thin -std=gnu++11 -Wall -Wextra -pedantic -Wshadow -Wold-style-cast -MD -MT sandbox/CMakeFiles/sandbox_vs.dir/sandbox_vs.cpp.o -MF sandbox/CMakeFiles/sandbox_vs.dir/sandbox_vs.cpp.o.d -o sandbox/CMakeFiles/sandbox_vs.dir/sandbox_vs.cpp.o -c /var/tmp/portage/dev-libs/cereal-1.3.2-r2/work/cereal-1.3.2/sandbox/sandbox_vs.cpp In file included from /var/tmp/portage/dev-libs/cereal-1.3.2-r2/work/cereal-1.3.2/sandbox/sandbox_vs.cpp:57: /var/tmp/portage/dev-libs/cereal-1.3.2-r2/work/cereal-1.3.2/include/cereal/types/tuple.hpp:98:41: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw] 98 | serialize<Height - 1>::template apply( ar, tuple ); | ^ /var/tmp/portage/dev-libs/cereal-1.3.2-r2/work/cereal-1.3.2/include/cereal/types/tuple.hpp:119:85: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw] 119 | tuple_detail::serialize<std::tuple_size<std::tuple<Types...>>::value>::template apply( ar, tuple ); | ^ 2 errors generated.
Potentially this: https://github.com/USCiLab/cereal/pull/835
In the future include a minimal example along with your compiler error.
Builds also fail on clang 20.1.8 with the same error message. Also worth mentioning that this still compiles cleanly on gcc 15.2
I fixed it the same way they did in mlpack: https://github.com/mlpack/mlpack/pull/3805/files#diff-7829468e86c1cc5d5133195b5cb48e1ff6c75e3e9203777f6b2e379d9e4882b3R75
By adding to the build:
# Fix cereal compilation on clang 19+; see
# https://github.com/USCiLab/cereal/pull/835
sed -i 's|::template apply|::apply|' cereal-1.3.2/include/cereal/types/tuple.hpp
Not great, but if it works, it works :)