summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.ext/addrfunc4.C
blob: 05312e4e5e7fa07e12058b367f42eb6e5d6250ad (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
// { dg-do run  }
// { dg-options "-fms-extensions" }
// Test that an object-dependent reference to a member function can be
// used to produce a pointer to member function, as in VC++.
// Contributed by Jason Merrill <jason@cygnus.com>

struct A
{
  int  f(int a) { return 0; }
  void f(int a, int b) { }
};

typedef int  (A::* pmf1)(int);
typedef void (A::* pmf2)(int, int);

int main()
{
  A a;
  pmf1 fn1;
  pmf2 fn2;

  fn1 = a.f; 
  fn1 = (pmf1)a.f;
  fn2 = (pmf2)a.f;
}