summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/virtual3.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/virtual3.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/virtual3.C25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/virtual3.C b/gcc/testsuite/g++.old-deja/g++.other/virtual3.C
new file mode 100644
index 000000000..c62af5444
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/virtual3.C
@@ -0,0 +1,25 @@
+// { dg-do run }
+struct B
+{
+ virtual int f() volatile
+ { return 1; }
+};
+
+struct D : public B
+{
+ int f()
+ { return 0; }
+};
+
+struct D2 : public D
+{
+ int f()
+ { return 2; }
+};
+
+int main()
+{
+ D2 d2;
+ D& d = d2;
+ return d.f();
+}