Problem with Multiple Inheritance and -pedantic
Ralf Hartmann
Ralf.Hartmann@IWR.Uni-Heidelberg.De
Mon Jun 26 05:14:00 GMT 2000
Hi there,
the appended program breaks when compiling with -pedantic, although we
think that it should compile just as fine as when not using that flag.
This problem exists with gcc2.95.2 as well as with the most recent
snapshot 2.96 20000626. The compiler loses the ability to cast from a
derived class to a base class that exists multiply in the inheritance
lattice.
Ralf Hartmann
==========================================================
struct Base {
void clear();
};
struct D1: public Base {};
struct D2: public Base {};
struct Final: public D1, public D2 {
void run(){ D1::clear(); };
};
=========================================================
Error messages:
bug_test.cc: In method `void Final::run()':
bug_test.cc:9: cannot convert a pointer of type `Final' to a pointer of type `Base'
bug_test.cc:9: because `Base' is an ambiguous base class
More information about the Gcc-bugs
mailing list