1// { dg-do run  }
2// Test that we only call f once and that pointers to different subobjects
3// compare as different.
4
5struct A { void f() { } };
6struct B: public A { };
7struct C: public A { };
8struct D : public B, public C { };
9
10typedef void (B::*bp)();
11typedef void (C::*cp)();
12typedef void (D::*dp)();
13
14dp d1;
15
16int call;
17
18dp f () { ++call; return d1; }
19
20int main()
21{
22  bp b = &A::f;
23  cp c = &A::f;
24  d1 = b;
25  dp d2 = c;
26  return (f() == d2 || call != 1);
27}
28