Boost logo

Boost Users :

Subject: Re: [Boost-users] [serialize] using virtual inheritance causes compiler error
From: Douwe Gelling (douwegelling_at_[hidden])
Date: 2017-03-02 10:57:56


(sorry for the extremely late reply, I just came across this issue again
and realised I never did)

It's good that it works in vs2013, but does this mean it ought to compile
anywhere and this is a bug though, or that vs2013 is just a fluke?

Your suggestion to override explicitly didn't help in my case
unfortunately. It seems to actually be a problem in Boost.TypeTraits, I've
commented on a similar issue there (see:
https://svn.boost.org/trac/boost/ticket/11323), but it's impacting the use
of serialization. Naively, I would expect the example code to compile when
using one of boost.Serialize's examples and merely overriding a base
function, but it breaks. It feels to me like a bug of some sort, would
people here agree?

On Fri, Oct 28, 2016 at 12:36 AM Gavin Lambert <gavinl_at_[hidden]>
wrote:

On 28/10/2016 00:17, Douwe Gelling wrote:
> c) It fails to compile on both apple LLVM 8.0.0 on osx, and on gcc 4.9
> on ubuntu 12.04

It compiles in VS2013...

> That makes the example compile, but doesn't tell me how to serialize an
> object with diamond inheritance, where a pure virtual method from the
> virtual base class is implemented by one of the classes in the middle.

On occasion with diamond inheritance it can help to explicitly instruct
the compiler which "path" to take by further overriding the method in
the class that rejoins the diamond. It's possible this may help with
your issue as well.

eg:

struct A
{
     virtual void act() = 0;
};

struct B1 : public virtual A
{
};

struct B2 : public virtual A
{
     virtual void act() override { ... }
};

struct C : public B1, public B2
{
     // explicitly delegate to one of the bases
     virtual void act() override { B2::act(); }
};

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net