Boost logo

Boost :

Subject: Re: [boost] [Serialization] virtual function and virtual inheritance
From: John Maddock (john_at_[hidden])
Date: 2010-01-28 12:22:26


> I have a compilation error with a virtual function inside a virtual base
> class.
> For example, I just add a function f() inside the unit test :
> "test_diamond.cpp".
>
> class base {
> ...
> virtual void f() =0;
> ...
> };
>
> class derived1 {
> ...
> virtual void f(){}
> ...
> };
>
> gcc 4.3, returns me an error:
> error: no unique final overrider for `virtual void base::f()' in
> `boost::detail::is_virtual_base_of_impl<derived1, final, mpl_::bool_<
> true> >::X'

Sigh... I suspect this is the same issue as:
https://svn.boost.org/trac/boost/ticket/3730 which we don't know how to
solve (indeed it might well be unsolvable).

One option might be to specialize the traits class for the problem classes:

namespace boost{
template<>
struct is_virtual_base_of<myderived, mybase>: public mpl::true_ {};
}

HTH, John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk