summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/net26.C
blob: 8d03278b99ecd700c4f3195c816f543f5ccef214 (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
// { dg-do run  }
// A test case found by InterViews testing...

extern "C" int printf(const char *, ...);

class A {
public:
	int foo() { printf("ok nv\n"); return 0; }
	virtual int vfoo() { printf("ok v\n"); return 0; }
};

struct S {
	int (A::*pfn1)();
	int (A::*pfn2)();
	int (A::*pfn3)();
};

// This failed before.
S s = { &A::foo, &A::vfoo, &A::foo };

A a;

int main() {
  (a.*s.pfn1)();
  (a.*s.pfn2)();
  printf("PASS\n");
  return 0;
}