Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3604: Access violation on diamond inheritance
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-04-10 00:18:13
#3604: Access violation on diamond inheritance
----------------------------------+-----------------------------------------
Reporter: kondo@⦠| Owner: ramey
Type: Support Requests | Status: reopened
Milestone: Boost 1.41.0 | Component: serialization
Version: Boost 1.40.0 | Severity: Not Applicable
Resolution: | Keywords:
----------------------------------+-----------------------------------------
Comment(by kondo@â¦):
I offer additional information.
I believe that if the virtual inheritance inclusion distinguished
correctly, static downcast from a virtual base class does not occur
anymore.
Because the void cast includes virtual inheritance case, the void cast
code is dispatched below class.
void_cast.hpp
{{{
template <class Derived, class Base>
class void_caster_virtual_base :
public void_caster
{
virtual bool has_virtual_base() const {
return true;
}
public:
virtual void const * downcast(void const * const t) const {
const Derived * d =
dynamic_cast<const Derived *>(
static_cast<const Base *>(t)
);
return d;
}
virtual void const * upcast(void const * const t) const {
const Base * b =
dynamic_cast<const Base *>(
static_cast<const Derived *>(t)
);
return b;
}
void_caster_virtual_base();
virtual ~void_caster_virtual_base();
};
}}}
And the void cast use dynamic_cast instead of static_cast.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3604#comment:12> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC