diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.jason/ref10.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.jason/ref10.C | 32 |
1 files changed, 32 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 000000000..4fe6ffdaf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.jason/ref10.C @@ -0,0 +1,32 @@ +// { dg-do run } +// 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); +} + +int main() { + D *p = new D; + foo(p); + return bar(p); +} |