This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/525: Problem with Multiple Inheritance and -pedantic



>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:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]