This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug c++/14017] New: Problem on gcc 3.4 with multiple inheritance having a common base


Multiple inheritance does not execute correctly on the following code : it 
cores dump. It is specific on gcc 3.4. The code works fine on gcc 3.3

#include <iostream>

class Base {
  public:
   virtual ~Base() {}
   virtual int value() const { return 0; }
};

class FstDerived : public Base {
  public:
   virtual int _fst() const { return 1; }
   int fst() const { return _fst(); }
};

class SndDerived : public Base {
  public:
   virtual int _snd() const { return 2; }
   int snd() const { return _snd(); }
};

class Final : public FstDerived, public SndDerived {
  protected:
   virtual int _snd() const { return SndDerived::_snd() + 2; }
  public:
   int snd() const { return SndDerived::snd(); }
};

int main() {
   FstDerived* pfdFst = new Final();
   std::cout << ((const Final&) *pfdFst).snd() << std::endl;
};

-- 
           Summary: Problem on gcc 3.4 with multiple inheritance having a
                    common base
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Franck dot Vedrine at cea dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: gcc version 3.4.0 20040128 (prerelease)
  GCC host triplet: i686-pc-cygwin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14017


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