1 // { dg-do run }
2 // Test rtti hint flags
3 // Copyright (C) 2000, 2003 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 3 Apr 2000 <nathan@nathan@codesourcery.com>
5
6 #include <typeinfo>
7
8 #if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
9 #include <cxxabi.h>
10
11 struct A {int m;};
12 struct A1vA : virtual A {int m;};
13 struct A2vA : virtual A {int m;};
14 struct A1A : A {int m;};
15 struct A2A : A {int m;};
16 struct B {int m;};
17
18 struct C1 : B, virtual A {int m;};
19
20 struct D1 : A1vA, A2vA {int m;};
21
22 struct E1 : A1A, A2A {int m;};
23
24 struct E2 : A1A, A2vA {int m;};
25
26 struct F1 : A1A, A1vA, A2vA {int m;};
27
28 struct P1 : protected A {int m;};
29
30 struct P2 : B, P1 {int m;};
31
32 using namespace abi;
33
expect(int flags,std::type_info const & info)34 int expect (int flags, std::type_info const &info)
35 {
36 abi::__vmi_class_type_info const *ptr =
37 dynamic_cast <abi::__vmi_class_type_info const *> (&info);
38 if (!ptr)
39 return 0;
40 if (ptr->__flags != flags)
41 return 0;
42 return 1;
43 }
44
main()45 int main ()
46 {
47 if (! expect (0, typeid (C1)))
48 return 1;
49 if (! expect (2, typeid (D1)))
50 return 2;
51 if (! expect (1, typeid (E1)))
52 return 3;
53 if (! expect (1, typeid (E2)))
54 return 4;
55 if (! expect (3, typeid (F1)))
56 return 5;
57
58 if (!expect (0, typeid (P1)))
59 return 6;
60 if (!expect (0, typeid (P2)))
61 return 7;
62
63 return 0;
64 }
65
66 #else
main()67 int main ()
68 {
69 return 0;
70 }
71 #endif
72