2009-07-17 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / rtti / dyncast4.C
blob2a5fd2b3b96190d386ad1568741397fa118a12f7
1 // Test to make sure that we keep searching if we don't find the type we
2 // want at the expected address.
4 // { dg-do run }
6 struct A
8   virtual void f() {};
9 };
11 struct B: A { };
13 struct C: A { };
15 struct D: B, C { };
17 int main()
19   D d;
20   A* ap = static_cast<B*>(&d);
21   C* cp = dynamic_cast<C*>(ap);
22   if (cp == 0)
23     return 1;
24   else
25     return 0;