diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/dcast2.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/dcast2.C | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/dcast2.C b/gcc/testsuite/g++.old-deja/g++.other/dcast2.C new file mode 100644 index 000000000..0f08e066e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/dcast2.C @@ -0,0 +1,17 @@ +// { dg-do assemble } + +// Based on a testcase by Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA> + +struct B { + virtual ~B(); +}; + +struct D : public B { +}; + +void foo() { + B x; + dynamic_cast<D*>(&x); // { dg-warning "" } will never succeed + B* p = &x; + dynamic_cast<D*>(p); +} |