Opened 9 years ago

Closed 9 years ago

#9412 closed Feature Requests (invalid)

Error message hidden by assert

Reported by: anonymous Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

I received the following run-time error:

Assertion failed: (null != bpos), function save, file /opt/local/include/boost/archive/detail/oserializer.hpp, line 436.

This is caused by the following lines:

            // since true_type is valid, and this only gets made if the 
            // pointer oserializer object has been created, this should never
            // fail
            const basic_pointer_oserializer * bpos
                = static_cast<const basic_pointer_oserializer *>(
                    boost::serialization::singleton<
                        archive_serializer_map<Archive>
                    >::get_const_instance().find(*true_type)
                );
            BOOST_ASSERT(NULL != bpos);
            if(NULL == bpos)
                boost::serialization::throw_exception(
                    archive_exception(
                        archive_exception::unregistered_class,
                        "derived class not registered or exported"
                    )
                );

Instead of the BOOST_ASSERT, I would have preferred to receive the respective error message.

Change History (2)

comment:1 by anonymous, 9 years ago

Type: BugsFeature Requests

Hmmm the ASSERT is there because this condition indicates some coding error in the serialization library. Throwing away the ASSERT effectively hides the error - which is not a good long term strategy. The most interesting question is why does this condition appear? What coding error which provoked it.

comment:2 by Robert Ramey, 9 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.