I refer to the following as “multiple re-inheritance”:
The common term for this is the diamond pattern (or diamond problem).
It is not an error per se, but as noted in the comments here, any attempt to access a direct base that is reduplicated elsewhere in the hierarchy will result in an ambiguity error.
One workaround would be to make the base indirect. The new inheriting constructors feature in C++11 allows perfect wrappers:
template< typename base, typename tag >
struct disambiguated_base : base
{ using base::base; };
Given an unused tag type, this generates a new class derived from, and functionally identical to, the given base. The tag type may be an incomplete class denoted by an elaborated-type-specifier:
struct GrandChild : Parent,
disambiguated_base< GrandParent, class grandchild_grandparent_tag > {
typedef disambiguated_base< GrandParent, grandchild_grandparent_tag >
my_direct_grandparent;
int num;
};
Now GrandChild
can use my_direct_grandparent::
to disambiguate member accesses.