This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/525: Problem with Multiple Inheritance and -pedantic
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/525: Problem with Multiple Inheritance and -pedantic
- From: Ralf dot Hartmann at iwr dot uni-heidelberg dot de
- Date: 11 Sep 2000 15:15:08 -0000
- Reply-To: Ralf dot Hartmann at iwr dot uni-heidelberg dot de
- Resent-Cc: gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, jason at gcc dot gnu dot org
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, Ralf.Hartmann@iwr.uni-heidelberg.de
>Number: 525
>Category: c++
>Synopsis: Problem with Multiple Inheritance and -pedantic
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Sep 11 08:16:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Ralf.Hartmann@iwr.uni-heidelberg.de
>Release: gcc2.95.2 and gcc version 2.96 20000911 (experimental)
>Organization:
>Environment:
>Description:
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 20000911. 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
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: