Opened 5 years ago

#13467 new Bugs

RTTI issue with non-polymorphic types in debug mode

Reported by: jlodos@… Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.67.0 Severity: Problem
Keywords: serialization rtti Cc:

Description

While serializing non-polymorphic types without RTTI in debug mode you get compiler warnings and execution crashes. In release mode everything works fine. This is because dynamic_cast is used for debugging purposes. The code is in smart_cast.hpp, starting in line 87:

                #if ! defined(NDEBUG)                               \
                || defined(__MWERKS__)
                    // do a checked dynamic cast
                    return cross::cast(u);
                #else

I believe the first line could be replaced with:

                #if (! defined(NDEBUG) && ! defined(BOOST_NO_RTTI) )  \

This solved the issue for me.

Change History (0)

Note: See TracTickets for help on using tickets.