1 // { dg-do assemble } 2 // GROUPS passed conversions 3 // cvt file 4 // Message-Id: <CC7oHn.B4F@izf.tno.nl> 5 // From: tom@izfcs.izf.tno.nl (Tom Vijlbrief) 6 // Subject: g++ 2.4.5 has problems with NON virtual shared base classes 7 // Date: Mon, 23 Aug 1993 12:10:34 GMT 8 9 10 #include <stdio.h> 11 12 #define FAIL 13 14 class Base { 15 public: Base()16 Base() { printf("Base::Base\n"); } ~Base()17 virtual ~Base() { printf("Base::~Base\n"); } v()18 virtual void v() { printf("Base::v\n"); } 19 }; 20 21 class Base2 { 22 public: Base2()23 Base2() { printf("Base2::Base2\n"); } ~Base2()24 virtual ~Base2() { printf("Base2::~Base2\n"); } v()25 virtual void v() { printf("Base2::v\n"); } 26 }; 27 28 class A: public Base { 29 public: A()30 A() { printf("A::A\n"); } ~A()31 ~A() { printf("A::~A\n"); } va()32 virtual void va() { printf("A::va\n"); } 33 }; 34 35 #ifdef FAIL 36 class B: public Base { 37 #else 38 class B: public Base2 { 39 #endif 40 public: B()41 B() { printf("B::B\n"); } ~B()42 ~B() { printf("B::~B\n"); } vb()43 virtual void vb() { printf("B::vb\n"); } 44 }; 45 46 class C: public A, public B { 47 public: C()48 C() { printf("C::C\n"); } ~C()49 ~C() { printf("C::~C\n"); } va()50 void va() { printf("C::va\n"); } 51 }; 52 53 main()54int main() 55 { 56 C *cp= new C; 57 cp->va(); 58 delete cp; 59 } 60 61