I found a problem with the g++ in RedHat 7.0, gcc-c++-2.96-54. The problem is with using virtual inheritance and virtual functions, where the function return value is overridden. Consider the following typical example: class ClassA { public: inline virtual ClassA * clone ( void ) { return new ClassA(*this); } }; class ClassB : public virtual ClassA { public: inline virtual ClassB * clone ( void ) { return new ClassB(*this); } }; the compiler gives the error: sorry, not implemented: adjusting pointers for covariant is this some joke? :) If the inheritance is changed from virtual to not virtual, the sample compiles. But than an error comes when using multiple inheritance. Consider the following: class ClassA { public: inline virtual ClassA * clone ( void ) { return new ClassA(*this); } }; class ClassB : public ClassA { public: inline virtual ClassB * clone ( void ) { return new ClassB(*this); } }; class ClassC : public ClassA { public: virtual ClassC * clone ( void ) { return new ClassC(*this); } }; class ClassD : public ClassB, public ClassC { public: inline virtual ClassD * clone ( void ) { return new ClassD(*this); } }; then the following errors come: type `ClassA' is ambiguous base class for type `ClassD' type `ClassA' is ambiguous base class for type `ClassD' Both of the above sample compile well with the g++ supplied in RedHat 6.2. To my knowledge, both sample are correct C++ code, so I don't understand why it doesn't compile.
Because this needs runtime adjustments of returned pointers. It is implemented neither in g++ 2.95.x nor in our 2.96 nor in CVS g++.