https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55120

--- Comment #12 from Anthony Sharp <anthonysharp15 at gmail dot com> ---
Okay, so it actually turns out public virtual bases CAN be derived from, since
the C++ spec literally gives an example of just that (e.g. see
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf at page 248
[I know it's the draft but I'm poor]).

As such, Visual Studio has no complaints about the following code:

class V {  };
class A : virtual public V {  };
class C : public A {  };

But it spits out warnings for this:

class V {  };
class A : virtual V {  };
class C : public A {  };

The problem is this issue requires such in-depth knowledge of the standard that
it's difficult to form an actual opinion on it. I will do some more research
and then maybe I'll be able to comment more. Overall though it seems the issue
is whether private inheritance affects the accessibility of the destructor
and/or constructor of a virtually-inherited baseclass to other deriving
classes. I could be wrong about that though.

What I will say though is that even without having to dive into the technical
details, the fact that one would not be able to derive from a private virtual
base makes no sense, intuitively speaking. A private base can be derived from.
A virtual base can be derived from. I don't see why it should make any
practical difference that the base might be both virtual and private.

Reply via email to