Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.mike/dyncast2.C

raw
1 // { dg-do run { xfail sparc64-*-elf arm-*-pe } }
2 // { dg-options "-fexceptions -w" }
3
4 // Ensure reference handling works.
5
6 #include <typeinfo>
7
8 struct B {
9 virtual int f() { }
10 } ob;
11
12 struct D : public B {
13 virtual int f() { }
14 } od;
15
16 main() {
17 B *b=&ob;
18 try {
19 void *vp = &dynamic_cast<D&>(*b);
20 return 1;
21 } catch (std::bad_cast) {
22 return 0;
23 }
24 return 1;
25 }