Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.mike/net26.C

raw
1 // { dg-do run }
2 // A test case found by InterViews testing...
3
4 extern "C" int printf(const char *, ...);
5
6 class A {
7 public:
8 int foo() { printf("ok nv\n"); return 0; }
9 virtual int vfoo() { printf("ok v\n"); return 0; }
10 };
11
12 struct S {
13 int (A::*pfn1)();
14 int (A::*pfn2)();
15 int (A::*pfn3)();
16 };
17
18 // This failed before.
19 S s = { &A::foo, &A::vfoo, &A::foo };
20
21 A a;
22
23 int main() {
24 (a.*s.pfn1)();
25 (a.*s.pfn2)();
26 printf("PASS\n");
27 return 0;
28 }