Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#8400 closed Bugs (fixed)

Serialization uses typeid in shared_ptr helper even when compileing without RTTI support

Reported by: mika.fischer@… Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc:

Description

The culprit is the shared_ptr helper stuff, which uses typeid, which fails without RTTI.

boost::shared_ptr uses boost::detail::sp_typeinfo instead of std::type_info and BOOST_SP_TYPEID instead of typeid, which also work without RTTI.

If there are no unintended side effects, they should probably also be used by boost::serialization.

Patch attached.

Attachments (1)

boost-serialization-shared_ptr-no-rtti.patch (2.5 KB ) - added by Mika Fischer <mika.fischer@…> 10 years ago.

Download all attachments as: .zip

Change History (10)

by Mika Fischer <mika.fischer@…>, 10 years ago

comment:1 by Robert Ramey, 9 years ago

Hmmmm - this actually requires some careful thought. The serialization library uses the concept of "no typeid" as an indicator that there is no such facility and some other type id facility has been provided. Shared ptr implements its own typeid facility. So depending upon the implementation detail in shared_ptr raises questions about what it is we really want. Naturally I'm reluctant to spend time on this question at this point. I was even considering just dropping the old shared_ptr implementation.

Does the current situation cause any problems?

comment:2 by Mika Fischer <mika.fischer@…>, 9 years ago

Well, it does prevent the use of boost::serialization with boost::shared_ptr when compiling without RTTI.

comment:3 by Robert Ramey, 9 years ago

hmm - do you have to use version 1.32? can't you use a later version? Wouldn't this fix the problem?

comment:4 by Robert Ramey, 9 years ago

Another question:

You've submitted patch for boost/serialization/detail/shared_count_132.hpp - are you still using this header? It applies to an implementation over 20 years old! Does current code actually use this? What would happen if I just dropped this header?

Robert Ramey.

comment:5 by Robert Ramey, 9 years ago

Note: I've update the shared_ptr_helper implementation. You can try this. BUT the shared_*132 hasn't changed. Please try using the latest version of shared_ptr serialization (NOT *132) and report back. If I don't get more feedback I'll have to close this ticket.

Robert Ramey

comment:6 by Mika Fischer <mika.fischer@…>, 9 years ago

I don't use that old version. But it seems to me that every archive includes boost/archive/shared_ptr_helper.hpp which in turn includes boost/serialization/shared_ptr_132.hpp which in turn includes boost/serialization/detail/shared_ptr_132.hpp

So as far as I can tell, there is just no way to avoid including this header. And including it is all that's needed for the compiler to freak out because of the use of typeid etc.

comment:7 by Robert Ramey, 9 years ago

I've made some changes which I think will address this.

a) a newer version of shared_ptr_helper.hpp - moved to include/serialization b) I've changed things so that *132.hpp files aren't included - not yet checked in but stay tuned.

I think these changes may address your symptom here.

comment:8 by Robert Ramey, 9 years ago

Resolution: fixed
Status: newclosed

comment:9 by Mika Fischer <mika.fischer@…>, 8 years ago

Your change probably fixed this problem. Unfortunalety however, the restructurization caused other issues when RTTI is disabled. I've opened a new bug for the new issue: https://svn.boost.org/trac/boost/ticket/10280

Note: See TracTickets for help on using tickets.