Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.martin/pmf1.C

raw
1 // { dg-do run }
2 // Based on a test case by Andrew Bell <[email protected]>
3 // Check for pointer-to-virtual-function calls on
4 // bases without virtual functions.
5
6 struct B{};
7
8 struct D: public B{
9 virtual void foo();
10 };
11
12 void D::foo(){}
13
14 int main()
15 {
16 B *b = new D;
17 void (B::*f)() = static_cast<void (B::*)()>(&D::foo);
18 (b->*f)();
19 }