summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.martin/pmf2.C
blob: e52ce9f61fa403accf3f2aa5c94a9d01dd1a51b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// { dg-do run  }
// { dg-options "-Wno-pmf-conversions" }
// Test conversion of pointers to virtual member functions to
// pointers to non-member functions.

struct A{
  int i;
  A () :i(1){}
  virtual void foo();
}a;

void A::foo()
{
  i = 0;
}

int main()
{
  void (*f)(A*) = (void(*)(A*))(&A::foo);
  f(&a);
  return a.i;
}