diff options
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.martin/pmf1.C | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.martin/pmf1.C b/gcc/testsuite/g++.old-deja/g++.martin/pmf1.C new file mode 100644 index 0000000..5c6bb54 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.martin/pmf1.C @@ -0,0 +1,18 @@ +// Based on a test case by Andrew Bell <andrew.bell@bigfoot.com> +// Check for pointer-to-virtual-function calls on +// bases without virtual functions. + +struct B{}; + +struct D:B{ + virtual void foo(); +}; + +void D::foo(){} + +int main() +{ + B *b = new D; + void (B::*f)() = static_cast<void (B::*)()>(&D::foo); + (b->*f)(); +} |