aboutsummaryrefslogtreecommitdiffstats
path: root/test/C++Frontend/pointer_method.cpp
blob: a8f76ab20c8c52792e6e293b25cb485cbfc0d1fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>

struct B { 
  int X;
  void i() {
    printf("i, %d\n", X);
  }
  void j() {
    printf("j, %d\n", X);
  }
};

void foo(int V, void (B::*Fn)()) {
   B b;  b.X = V;
   (b.*Fn)();
}

int main() {
	foo(4, &B::i);
	foo(6, &B::j);
	foo(-1, &B::i);
	return 0;
}