Can't register polymorhpic type named StaticObject
I'm register a class of mine named StaticObject, but I think this collides because cereal itself has a class named StaticObject.
../subprojects/cereal-1.2.2/include/cereal/details/polymorphic_impl.hpp: In instantiation of ‘const cereal::detail::bind_to_archives<T, Tag>& cereal::detail::bind_to_archives<T, Tag>::bind() const [with T = cereal::detail::StaticObject<Dust>; Tag = cereal::detail::{anonymous}::polymorphic_binding_tag]’:
../src/Dust.hpp:18:1: required from here
../subprojects/cereal-1.2.2/include/cereal/details/polymorphic_impl.hpp:736:9: error: static assertion failed: Attempting to register non polymorphic type
static_assert( std::is_polymorphic<T>::value,
^~~~~~~~~~~~~
../src/Dust.hpp:18 is this line:
CEREAL_REGISTER_TYPE(StaticObject<Dust>)
StaticObject is a template and definitely polymorphic. If I move it into it's own namespace, everything works.
Can you show the full class definition for Dust? This might be a name collision or it might be something as simple as not having a virtual function.
Dust isn't the class I'm trying to register, but StaticObject (which happens to be a template). Here's a minimal example to reproduce the error:
struct StaticObject
{
virtual ~StaticObject() = default;
};
CEREAL_REGISTER_TYPE(StaticObject)
Another good workaround is using CEREAL_REGISTER_TYPE_WITH_NAME(::StaticObject, "StaticObject").