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: foo()8 int foo() { printf("ok nv\n"); return 0; } vfoo()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 main()23int main() { 24 (a.*s.pfn1)(); 25 (a.*s.pfn2)(); 26 printf("PASS\n"); 27 return 0; 28 } 29