[exception] exception_ptr missing virtual base parameters

The basic problem I'm experiencing is that getting an exception_ptr
results inherited parameters getting lost when virtual inheritance is used.
The code below demonstrates a simple example. "bar" is lost in the
print. Changing derived_except to be:
struct derived_except : base_except
{ int i; };
will cause the inherited values to be copied into the exception_ptr;
however, this has all the standard problems associated that come with
not using virtual inheritance.
This looks like a bug to me. The C++11 equivalent behaves has expected
and inherited values are maintained in the exception_ptr. Any thoughts?
michael
-------------- boost::exception_ptr version --------------
#include

I apologize for the late reply. It seems like Steven is right, there is no
way to make this work. I had two ideas that I tried:
1) I tried to use operator= to copy the virtual bases after the clone_impl
constructor has initialized them using their default constructors
(unfortunately). This makes the test case Michael posted work, however
operator= is not available for types that contain members of reference
types. I don't know how common this situation is, but in the
boost::exception tests I did have such exceptions (not on purpose) which
maybe means it isn't too unusual.
2) My other idea was instead of operator= to call ~T(), then the T copy
constructor with placement new over the T sub-object of clone_impl<T>. This
duly crashed the test program, which isn't all that surprising but it was
worth a try. :)
Emil
On Thu, Apr 11, 2013 at 8:27 AM, Steven Watanabe
participants (3)
-
Emil Dotchevski
-
Michael Caisse
-
Steven Watanabe