id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 12321,save for boost::optional doesn't call save_construct_data but load calls load_construct_data,Oleg Burchakov ,Robert Ramey,"$ cat main.cpp {{{ #include #include #include #include #include #include #include struct Foo { Foo(int aBar) : mBar(aBar) { if (mBar > 10) { throw std::logic_error(""too big bar""); } } int bar() const { return mBar; } private: int mBar; }; namespace boost { namespace serialization { template inline void serialize(Archive & ar, Foo& foo, const unsigned int /*version*/) { std::cout << __FUNCTION__ << "" called"" << std::endl; } template inline void save_construct_data(Archive & ar, const Foo* foo, const unsigned int /*version*/) { std::cout << __FUNCTION__ << "" called"" << std::endl; ar << foo->bar(); } template inline void load_construct_data(Archive & ar, Foo* foo, const unsigned int /*version*/) { std::cout << __FUNCTION__ << "" called"" << std::endl; int bar; ar >> bar; ::new(foo) Foo(bar); } } // serialization } // boost int main() { boost::optional oldFoo = Foo(10); std::ostringstream outStream; boost::archive::text_oarchive outArchive(outStream); outArchive & oldFoo; boost::optional newFoo; std::istringstream inStream(outStream.str()); boost::archive::text_iarchive inArchive(inStream); inArchive & newFoo; } }}} $ clang++ -I include -L lib -l boost_serialization --std=c++11 main.cpp $ LD_LIBRARY_PATH=lib ./a.out serialize called load_construct_data called terminate called after throwing an instance of 'boost::archive::archive_exception' what(): input stream error Aborted (core dumped) ",Bugs,closed,To Be Determined,serialization,Boost 1.61.0,Problem,fixed,,