diff --git a/core/src/io/serialization.cc b/core/src/io/serialization.cc index 57fdb6491..92e055ed0 100644 --- a/core/src/io/serialization.cc +++ b/core/src/io/serialization.cc @@ -160,14 +160,17 @@ namespace boost::serialization } ar & make_nvp("nodeType", nodeType); -#define UPCAST_FROM_TYPENAME(TYPENAME, CLASS) \ - case hpp::fcl::NODE_TYPE::TYPENAME: \ - if (Archive::is_loading::value) \ - { \ - geom.geometry = std::make_shared(); \ - } \ - ar & make_nvp("geometry", static_cast(*geom.geometry)); \ - break; +#define UPCAST_FROM_TYPENAME(TYPENAME, CLASS) \ + case hpp::fcl::NODE_TYPE::TYPENAME: \ + { \ + if (Archive::is_loading::value) \ + { \ + geom.geometry = std::make_shared(); \ + } \ + auto geometryDerived = std::dynamic_pointer_cast(geom.geometry); \ + ar & make_nvp("geometry", geometryDerived); \ + break; \ + } switch (nodeType) { // clang-format off