1 // { dg-do run } 2 // Bug: g++ doesn't compensate for finding a virtual function in a 3 // non-primary vtable when generating PMFs. 4 // Submitted by Jason Merrill <jason@cygnus.com> 5 6 struct A { ~AA7 virtual ~A() {} 8 }; 9 10 struct B { 11 virtual void f () = 0; 12 }; 13 14 struct C : public A, public B { 15 void f (); 16 }; 17 18 void (C::* B_f)() = &B::f; // this works 19 void (C::* C_f)() = &C::f; // this breaks 20 21 C* p; 22 f()23void C::f () 24 { 25 p = this; 26 } 27 main()28int main() 29 { 30 C c; 31 32 (c.*B_f)(); 33 if (p != &c) 34 return 1; 35 36 (c.*C_f)(); 37 if (p != &c) 38 return 1; 39 } 40