[xml-archive] gcc-4.3 fails with boost svn 45019

: ./boost/throw_exception.hpp:45: instantiated from void boost::throw_exception(const E&) [with E = boost::archive::archive_exception::exception_code] ./boost/archive/impl/xml_iarchive_impl.ipp:146: instantiated from void boost::archive::xml_iarchive_impl<Archive>::load_override(boost::archive::class_name_type&, int) [with Archive = boost::archive::naked_xml_iarchive]
./boost/exception/enable_error_info.hpp: In instantiation of boost::exception_detail::error_info_injector<boost::archive::archive_exception::exception_code> : ./boost/throw_exception.hpp:45: instantiated from void boost::throw_exception(const E&) [with E = boost::archive::archive_exception::exception_code] ./boost/archive/impl/xml_iarchive_impl.ipp:146: instantiated from void boost::archive::xml_iarchive_impl<Archive>::load_override(boost::archive::class_name_type&, int) [with Archive = boost::archive::naked_xml_iarchive] libs/serialization/src/xml_iarchive.cpp:38: instantiated from here ./boost/exception/enable_error_info.hpp:22: error: base type boost::archive::archive_exception::exception_code fails to be a struct or class type ./boost/exception/enable_current_exception.hpp: In instantiation of boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::archive::archive_exception::exception_code> libs/serialization/src/xml_iarchive.cpp:38: instantiated from here ./boost/exception/enable_current_exception.hpp:60: error: duplicate base type boost::exception_detail::error_info_injector<boost::archive::archive_exception::exception_code> invalid ./boost/exception/enable_error_info.hpp: In constructor boost::exception_detail::error_info_injector<T>::error_info_injector(const T&) [with T = boost::archive::archive_exception::exception_code] : ./boost/exception/enable_error_info.hpp:69: instantiated from typename boost::exception_detail::enable_error_info_return_type<T>::type boost::enable_error_info(const T&) [with T = boost::archive::archive_exception::exception_code] ./boost/throw_exception.hpp:45: instantiated from void boost::throw_exception(const E&) [with E = boost::archive::archive_exception::exception_code] ./boost/archive/impl/xml_iarchive_impl.ipp:146: instantiated from void boost::archive::xml_iarchive_impl<Archive>::load_override(boost::archive::class_name_type&, int) [with Archive = boost::archive::naked_xml_iarchive] libs/serialization/src/xml_iarchive.cpp:38: instantiated from here ./boost/exception/enable_error_info.hpp:25: error: type boost::archive::archive_exception::exception_code is not a direct base of boost::exception_detail::error_info_injector<boost::archive::archive_exception::exception_code> ./boost/exception/enable_current_exception.hpp: In constructor boost::exception_detail::clone_impl<T>::clone_impl(const T&) [with T = boost::exception_detail::error_info_injector<boost::archive::archive_exception::exception_code>] : ./boost/exception/enable_current_exception.hpp:144: instantiated from boost::exception_detail::clone_impl<T> boost::enable_current_exception(const T&) [with T = boost::exception_detail::error_info_injector<boost::archive::archive_exception::exception_code>] ./boost/throw_exception.hpp:45: instantiated from void boost::throw_exception(const E&) [with E = boost::archive::archive_exception::exception_code] ./boost/archive/impl/xml_iarchive_impl.ipp:146: instantiated from void boost::archive::xml_iarchive_impl<Archive>::load_override(boost::archive::class_name_type&, int) [with Archive = boost::archive::naked_xml_iarchive] libs/serialization/src/xml_iarchive.cpp:38: instantiated from here ./boost/exception/enable_current_exception.hpp:65: error: type boost::exception_detail::error_info_injector<boost::archive::archive_exception::exception_code> is not a direct base of boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::archive::archive_exception::exception_code>

Neal Becker:
./boost/exception/enable_error_info.hpp: In instantiation of boost::exception_detail::error_info_injector<boost::archive::archive_exception::exception_code> : ./boost/throw_exception.hpp:45: instantiated from void boost::throw_exception(const E&) [with E = boost::archive::archive_exception::exception_code] ./boost/archive/impl/xml_iarchive_impl.ipp:146: instantiated from void boost::archive::xml_iarchive_impl<Archive>::load_override(boost::archive::class_name_type&, int) [with Archive = boost::archive::naked_xml_iarchive] libs/serialization/src/xml_iarchive.cpp:38: instantiated from here ./boost/exception/enable_error_info.hpp:22: error: base type boost::archive::archive_exception::exception_code fails to be a struct or class type
This is (pedantically speaking) a bug in the new throw_exception (it doesn't allow throwing non-class types) that exposes a bug in the serialization library (it throws the invalid_class_name enum value directly instead of constructing an archive_exception from it). It might be a good idea to retain the throw_exception "bug" as a feature to catch similar mistakes. Throwing a non-class is rarely intentional. I've applied the obvious fix to the xml_(w)iarchive_impl.ipp that allows me to build the serialization library. I'm sure that Robert will correct me if I've done something wrong. :-)

On 5/2/08, Peter Dimov <pdimov@pdimov.com> wrote:
Neal Becker: This is (pedantically speaking) a bug in the new throw_exception (it doesn't allow throwing non-class types) that exposes a bug in the serialization library (it throws the invalid_class_name enum value directly instead of constructing an archive_exception from it).
The throw_exception() function template now throws an exception of type that derives the type used to instantiate it, and this doesn't work for non-class types. I admit that I completely missed this case. My recommendation is to change the throw_exception() documentation to specify that it must be used with objects of user-defined types. The alternative solution is to fix the "bug" in throw_exception() and allow non-class types, but that would disable the exception_ptr functionality for these exceptions (on platforms without compiler support for it.) Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode

On 5/2/08, Peter Dimov <pdimov@pdimov.com> wrote:
Neal Becker:
This is (pedantically speaking) a bug in the new throw_exception (it doesn't allow throwing non-class types) that exposes a bug in the serialization library (it throws the invalid_class_name enum value directly instead of constructing an archive_exception from it).
Peter makes another observation, throw_exception() has always required that the type passed to it derives from std::exception, because it allows the boost exceptions to be disabled, in which case the user is expected to supply a definition of throw_exception that takes a std::exception reference. I will change throw_exception to induce a compile error if the passed type does not derive from std::exception. Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode
participants (3)
-
Emil Dotchevski
-
Neal Becker
-
Peter Dimov