id summary reporter owner description type status milestone component version severity resolution keywords cc 5106 std::bad_cast thrown in the boost::archive::basic_binary_(o|i)primitive constructor gleize.pierre@… Robert Ramey "{{{ #!div style=""font-size: 80%"" Code highlighting: {{{#!cpp std::ofstream ofs( ""./test.dat"" ); ::boost::archive::binary_oarchive oa( ofs ); }}} }}} Tested with gcc 4.6 on MacOSX, this simple piece of code throws a std::bad_cast exception with Boost 1.45.0 I found a quick fix. Replace this : {{{ #!div style=""font-size: 80%"" include/boost/archive/basic_binary_oprimitive.hpp {{{#!cpp 108 BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) 109 basic_binary_oprimitive( 110 std::basic_streambuf & sb, 111 bool no_codecvt 112 ); }}} }}} By this : {{{ #!div style=""font-size: 80%"" include/boost/archive/basic_binary_oprimitive.hpp {{{#!cpp 108 BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) 109 basic_binary_oprimitive( 110 std::basic_streambuf & sb, 111 bool no_codecvt 112 ) : m_sb( sb ) 113 #ifndef BOOST_NO_STD_LOCALE 114 , locale_saver( sb ) 115 #endif 116 {}; }}} }}} Same modifications for the file basic_binary_'''i'''primitive.hpp. I'm not sure this is the right thing to do, and I don't understand why the constructor didn't have any body. Is there a default behavior for that kind of constructor ? " Bugs closed To Be Determined serialization Boost 1.45.0 Problem invalid bad_cast serialization archive constructor