blob: 11ac0daa6bc13daacf748654cc7aaf32658e52a9 (
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
31
32
33
34
35
|
// { dg-do run }
// This is a test case to make sure the explicit cast on a pointer to
// a member function works ok.
// prms-id: 3060
extern "C" int printf(const char *, ...);
class Object;
typedef void (Object::*VoidObjMemberFunc)(Object *tracker, void *ap);
class Object {
public:
int foo;
};
class Clipper: public Object {
public:
int bar;
void Feedback(Object*, void*);
};
void Clipper::Feedback(Object *tracker, void *ap) {
printf("Doing feedback\n");
}
void vfunc(VoidObjMemberFunc of, Object *op, void *v1) {
(op->*of)(op, v1);
}
int main() {
Object o;
vfunc((VoidObjMemberFunc)&Clipper::Feedback, &o, 0);
return 0;
}
|