summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/pmf7.C
blob: ab9ead011c00f04bcb7c619ab777b117f7ea9698 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// { dg-do run  }
class A;
typedef int (A::*f_ptr) (void);

class B {
public:
  B() {} ~B() {}
  B& dummy(f_ptr cb) { return *this; }
};

template<class SP, class CB> SP& call_dummy(SP* sp, CB cb) {
  sp->dummy(cb);
  return *sp;
}

class A {
public:
  A() {} ~A() {}
  int ok() { return 0; }
  A& call_it(B* s) {
    call_dummy(s, &A::ok);
    return *this;
  }
};

int main() {
  A a; B b;
  a.call_it(&b);
  return 0;
}