Re: [Boost-bugs] [Boost C++ Libraries] #3604: Access violation on diamond inheritance

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3604: Access violation on diamond inheritance
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-04-03 05:46:34


#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@…):

 Thanks for reply.
 I checked your modification. It is surely based on my idea.
 And My test failed.

 I think there are some problems in your modification.
 Consider the case of cls1.png, abc1.cpp, cls2.png and abc2.cpp
 (attached.file).

 The new shortcut element of void_caster_registry is made by already
 registered member and current registering member.

 And if either includes virtual base, it shall include virtual base.

 {{{
 110 void_caster_shortcut(
 111 extended_type_info const * derived,
 112 extended_type_info const * base,
 113 std::ptrdiff_t difference,
 114 bool includes_virtual_base,
 115 void_caster const * const parent
 116 ) :
 117 void_caster(derived, base, difference, parent),
 118 m_includes_virtual_base(includes_virtual_base)
 119 {
 120 recursive_register(includes_virtual_base);
 121 }
 }}}

 I think the member function recursive_register() needs the argument
 includes_virtual_base.

 And in the member function recursive_register(), 'logical OR' operation is
 needed.

 {{{
 243 if(* m_derived == * (*it)->m_base){
 244 const void_caster_argument vca(
 245 (*it)->m_derived,
 246 m_base
 247 );
 248 void_cast_detail::set_type::const_iterator i;
 249 i = s.find(& vca);
 250 if(i == s.end()){
 251 new void_caster_shortcut(
 252 (*it)->m_derived,
 253 m_base,
 254 m_difference + (*it)->m_difference,
 255 (*it)->has_virtual_base() || includes_virtual_base,
 256 this
 257 );
 258 }
 259 }
 260 if(* (*it)->m_derived == * m_base){
 261 const void_caster_argument vca(
 262 m_derived,
 263 (*it)->m_base
 264 );
 265 void_cast_detail::set_type::const_iterator i;
 266 i = s.find(& vca);
 267 if(i == s.end()){
 268 new void_caster_shortcut(
 269 m_derived,
 270 (*it)->m_base,
 271 m_difference + (*it)->m_difference,
 272 (*it)->has_virtual_base() || includes_virtual_base,
 273 this
 274 );
 275 }
 276 }
 }}}

 Based on this idea, I modified the void_caster.cpp you attached.

 It is void_cast_add_or.cpp (attached file).

 After this modification, my test succeeded.

 What do you think?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3604#comment:11>
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