summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.law/casts2.C
blob: cba10f2807e6ecf24baeec93e359cc9c8164ca61 (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
36
37
38
39
// { dg-do assemble  }
// GROUPS passed casts
class VObject;

typedef int boolean;

typedef boolean (VObject::*method)();
typedef boolean (VObject::*method0)();
typedef boolean (VObject::*method1)(long);

#define methodOf(o,m)  (method)(&o::m)


class VObject {
    public:
    boolean perform(method );
    boolean perform(method , long);
    void    affectMethod(method );
    void    dummy(){}
};


boolean VObject::perform(method m)
{
        method0 q = (method0)m;
        return(this->*q)();
}


boolean VObject::perform(method m, long param)
{
        method1 q = (method1)m;
        return(this->*q)(param);
 }

void VObject::affectMethod(method m)
{
        m =   methodOf(VObject, dummy);
}