summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.ext/bound1.C
blob: 5812f4afaa02cd431819108149aca156acd98833 (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
// { dg-do assemble  }
// { dg-options "-Wno-pmf-conversions" }
// Testcase for cast of bound pointer to member function.

struct A {
  int f ();
};

typedef int (*fptr)(A *);
typedef void* vptr;
typedef int (A::*pmf)();

void foo (A* ap, pmf fp, int A::* ip)
{
  fptr p;
  vptr q;
  A a;

  p = (fptr)(ap->*fp);
  p = (fptr)(ap->*fp);
  p = (fptr)(ap->*(&A::f));
  p = (fptr)(a.*fp);
  p = (fptr)(a.*(&A::f));

  q = (vptr)(ap->*fp);
  q = (vptr)(ap->*(&A::f));
  q = (vptr)(a.*fp);
  q = (vptr)(a.*(&A::f));
}