aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.jason/ref10.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.jason/ref10.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.jason/ref10.C31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/ref10.C b/gcc/testsuite/g++.old-deja/g++.jason/ref10.C
new file mode 100644
index 00000000000..faadb2e79da
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.jason/ref10.C
@@ -0,0 +1,31 @@
+// Test that conversion from D* to B*& works properly.
+
+extern "C" int printf (const char *, ...);
+
+struct V {
+ int a;
+};
+
+struct B: virtual V {
+ int b;
+};
+
+struct D: B {
+ int c;
+};
+
+V* gp = 0;
+
+void foo(V * const &r) {
+ gp = r;
+}
+
+int bar(V *r) {
+ return (r != gp);
+}
+
+main() {
+ D *p = new D;
+ foo(p);
+ return bar(p);
+}