diff --git a/gtsam/base/std_optional_serialization.h b/gtsam/base/std_optional_serialization.h index 265ef1620..db5e994e9 100644 --- a/gtsam/base/std_optional_serialization.h +++ b/gtsam/base/std_optional_serialization.h @@ -48,6 +48,7 @@ */ #ifdef __GNUC__ #if __GNUC__ >= 7 && __cplusplus >= 201703L +// Based on https://github.com/borglab/gtsam/issues/1738, we define U as a complete type. namespace boost { namespace serialization { struct U{}; } } namespace std { template<> struct is_trivially_default_constructible : std::false_type {}; } namespace std { template<> struct is_trivially_copy_constructible : std::false_type {}; } diff --git a/gtsam/base/tests/testStdOptionalSerialization.cpp b/gtsam/base/tests/testStdOptionalSerialization.cpp index d9bd1da4a..3c1310aa6 100644 --- a/gtsam/base/tests/testStdOptionalSerialization.cpp +++ b/gtsam/base/tests/testStdOptionalSerialization.cpp @@ -60,8 +60,6 @@ public: TestOptionalStruct() = default; TestOptionalStruct(const int& opt) : opt(opt) {} - // A copy constructor is needed for serialization - TestOptionalStruct(const TestOptionalStruct& other) = default; bool operator==(const TestOptionalStruct& other) const { // check the values are equal return *opt == *other.opt;