summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.martin/pmf1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.martin/pmf1.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.martin/pmf1.C19
1 files changed, 19 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 000000000..108754b28
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.martin/pmf1.C
@@ -0,0 +1,19 @@
+// { dg-do run }
+// 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: public B{
+ virtual void foo();
+};
+
+void D::foo(){}
+
+int main()
+{
+ B *b = new D;
+ void (B::*f)() = static_cast<void (B::*)()>(&D::foo);
+ (b->*f)();
+}