This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Problem with Multiple Inheritance and -pedantic
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Problem with Multiple Inheritance and -pedantic
- From: Ralf Hartmann <Ralf dot Hartmann at IWR dot Uni-Heidelberg dot De>
- Date: Mon, 26 Jun 2000 11:13:57 -0100 (GMT+1)
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