1 // PR c++/43120 2 // { dg-do run } 3 4 extern "C" void abort (); 5 6 struct A { 7 int a; 8 AA9 A(int a_) : a(a_) {} 10 AA11 A(const A &other) { } 12 dummyA13 virtual void dummy() {} 14 }; 15 16 struct B { 17 virtual B *clone() const = 0; 18 }; 19 20 struct C : public virtual B { 21 virtual C *clone() const = 0; 22 }; 23 24 struct E* ep; 25 struct E : public A, public C { EE26 E(int a_) : A(a_) { ep = this; } 27 cloneE28 virtual E *clone() const { 29 if (this != ep) 30 abort(); 31 return 0; 32 } 33 }; 34 main()35int main() { 36 E *a = new E(123); 37 C *c = a; 38 B *b = a; 39 c->clone(); 40 b->clone(); 41 delete a; 42 return 0; 43 } 44