Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.other / pmf6.C
blob4dea631462ef58e3da7aedef98fbb2863cc75ab5
1 // { dg-do run  }
2 // Test that we only call f once and that pointers to different subobjects
3 // compare as different.
5 struct A { void f() { } };
6 struct B: public A { };
7 struct C: public A { };
8 struct D : public B, public C { };
10 typedef void (B::*bp)();
11 typedef void (C::*cp)();
12 typedef void (D::*dp)();
14 dp d1;
16 int call;
18 dp f () { ++call; return d1; }
20 int main()
22   bp b = &A::f;
23   cp c = &A::f;
24   d1 = b;
25   dp d2 = c;
26   return (f() == d2 || call != 1);