2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.abi / vmihint.C
blobfd9f3766f5b8a4cdeef431d0ddc2bfa404b01f67
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>
6 #include <typeinfo>
8 #if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
9 #include <cxxabi.h>
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;};
18 struct C1 : B, virtual A {int m;};
20 struct D1 : A1vA, A2vA {int m;};
22 struct E1 : A1A, A2A {int m;};
24 struct E2 : A1A, A2vA {int m;};
26 struct F1 : A1A, A1vA, A2vA {int m;};
28 struct P1 : protected A {int m;};
30 struct P2 : B, P1 {int m;};
32 using namespace abi;
34 int expect (int flags, std::type_info const &info)
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;
45 int main ()
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;
66 #else
67 int main ()
69   return 0;
71 #endif