2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.pt / ptrmem2.C
blobf14611c1af25c0ae55c6e73990963d037c5e95cc
1 // { dg-do run  }
2 struct S;
4 template <S* (S::*p)()>
5 struct F {
6   S* f (S& s)
7     {
8       return (s.*p)();
9     }
12 template <int S::*p>
13 struct D {
14   void d (S& s)
15     {
16       (s.*p) = 3;
17     }
20 struct S {
21   S* g ();
22   int i;
23   F<&S::g> fg;
24   D<&S::i> di;
25   S* h(), k(F<&S::h>);
26   F<&S::g> fg2;
27   D<&S::i> di2;
30 S* S::g()
32   return this;
35 S* S::h()
37   return this;
40 int main()
42   S s;
43   s.i = 2;
44   s.di.d (s);
45   if (s.i != 3)
46     return 1;
47   if (s.fg2.f(s) != &s)
48     return 1;