Merged trunk at revision 161680 into branch.
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr44357.C
blob3380350e81b8d836bd6cd2bf644830c9fa799704
1 /* { dg-do compile } */
2 extern "C"
4   typedef long unsigned int size_t;
6 namespace llvm
8   namespace dont_use
9   {
10     template < typename T > double is_class_helper (...);
11   }
12   template < typename T > struct is_class
13   {
14   public:enum
15     { value = sizeof (char) == sizeof (dont_use::is_class_helper < T > (0)) };
16   };
17     template < typename T > struct isPodLike
18   {
19     static const bool value = !is_class < T >::value;
20   };
22 namespace std __attribute__ ((__visibility__ ("default")))
24   template < typename _Iterator > struct iterator_traits
25   {
26   };
27   template < typename _Tp > struct iterator_traits <_Tp * >
28   {
29     typedef _Tp value_type;
30   };
33 namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
35   template < typename _Tp > class new_allocator
36   {
37   public:typedef size_t size_type;
38     typedef const _Tp & const_reference;
39   };
42 namespace std __attribute__ ((__visibility__ ("default")))
44 template < typename _Tp > class allocator:public __gnu_cxx::new_allocator <
45     _Tp >
46   {
47   public:typedef size_t size_type;
48     template < typename _Tp1 > struct rebind
49     {
50       typedef allocator < _Tp1 > other;
51     };
52   };
53   template < typename _Tp, typename _Alloc > struct _Vector_base
54   {
55     typedef typename _Alloc::template rebind < _Tp >::other _Tp_alloc_type;
56   };
57 template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector:protected _Vector_base < _Tp,
58     _Alloc
59     >
60   {
61     typedef _Vector_base < _Tp, _Alloc > _Base;
62     typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
63   public:typedef _Tp value_type;
64     typedef typename _Tp_alloc_type::const_reference const_reference;
65     typedef size_t size_type;
66     size_type size () const
67     {
68     } const_reference operator[] (size_type __n) const
69     {
70   }};
73 namespace llvm
75   struct LandingPadInfo;
76   class DwarfException
77   {
78     static bool PadLT (const LandingPadInfo * L, const LandingPadInfo * R);
79     struct CallSiteEntry
80     {
81     };
82     void EmitExceptionTable ();
83   };
85 namespace std __attribute__ ((__visibility__ ("default")))
87   template < typename _RandomAccessIterator,
88     typename _Compare >
89     void __unguarded_linear_insert (_RandomAccessIterator __last,
90                                     _Compare __comp)
91   {
92     typename iterator_traits < _RandomAccessIterator >::value_type __val =
93       (*__last);
94     _RandomAccessIterator __next = __last;
95     while (__comp (__val, *__next))
96       {
97       }
98   }
99   template < typename _RandomAccessIterator,
100     typename _Compare > void __insertion_sort (_RandomAccessIterator __first,
101                                                _RandomAccessIterator __last,
102                                                _Compare __comp)
103   {
104     for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)
105       {
106         if (__comp (*__i, *__first))
107           {
108           }
109         else
110           std::__unguarded_linear_insert (__i, __comp);
111       }
112   }
113   enum
114   { _S_threshold = 16 };
115   template < typename _RandomAccessIterator,
116     typename _Compare >
117     void __final_insertion_sort (_RandomAccessIterator __first,
118                                  _RandomAccessIterator __last,
119                                  _Compare __comp)
120   {
121     if (__last - __first > int (_S_threshold))
122       {
123         std::__insertion_sort (__first, __first + int (_S_threshold), __comp);
124       }
125   }
126   template < typename _RandomAccessIterator,
127     typename _Compare > inline void sort (_RandomAccessIterator __first,
128                                           _RandomAccessIterator __last,
129                                           _Compare __comp)
130   {
131     if (__first != __last)
132       {
133         std::__final_insertion_sort (__first, __last, __comp);
134       }
135   }
138 namespace llvm
140   class SmallVectorBase
141   {
142   protected:void *BeginX, *EndX, *CapacityX;
143     struct U
144     {
145     } FirstEl;
146   protected:  SmallVectorBase (size_t Size):BeginX (&FirstEl), EndX (&FirstEl),
147       CapacityX ((char *) &FirstEl + Size)
148     {
149   }};
150 template < typename T > class SmallVectorTemplateCommon:public
151     SmallVectorBase
152   {
153   public: SmallVectorTemplateCommon (size_t Size):SmallVectorBase (Size)
154     {
155     } typedef size_t size_type;
156     typedef T *iterator;
157     iterator begin ()
158     {
159     } iterator end ()
160     {
161     } size_type size () const
162     {
163   }};
164 template < typename T, bool isPodLike > class SmallVectorTemplateBase:public SmallVectorTemplateCommon <
165     T >
166   {
167   public: SmallVectorTemplateBase (size_t Size):SmallVectorTemplateCommon < T >
168       (Size)
169     {
170   }};
171 template < typename T > class SmallVectorImpl:public SmallVectorTemplateBase < T,
172     isPodLike < T >::value >
173   {
174     typedef SmallVectorTemplateBase < T, isPodLike < T >::value > SuperClass;
175   public:typedef typename SuperClass::iterator iterator;
176     explicit SmallVectorImpl (unsigned N):SmallVectorTemplateBase < T,
177       isPodLike < T >::value > (N * sizeof (T))
178     {
179     }
180   };
181   template < typename T,
182     unsigned N > class SmallVector:public SmallVectorImpl < T >
183   {
184     typedef typename SmallVectorImpl < T >::U U;
185     enum
186     { MinUs =
187         (static_cast < unsigned int >(sizeof (T)) * N + static_cast <
188          unsigned int >(sizeof (U)) - 1) /static_cast <
189         unsigned int >(sizeof (U)), NumInlineEltsElts =
190         MinUs > 1 ? (MinUs - 1) : 1, NumTsAvailable =
191         (NumInlineEltsElts + 1) * static_cast <
192         unsigned int >(sizeof (U)) / static_cast <
193         unsigned int >(sizeof (T)) };
194   public:  SmallVector ():SmallVectorImpl < T > (NumTsAvailable)
195     {
196     }
197   };
198   struct LandingPadInfo
199   {
200     std::vector < int >TypeIds;
201     union
202     {
203     } Contents;
204   };
207 using namespace llvm;
208 bool
209 DwarfException::PadLT (const LandingPadInfo * L, const LandingPadInfo * R)
211   const std::vector < int >&LIds = L->TypeIds, &RIds = R->TypeIds;
212   unsigned LSize = LIds.size (), RSize = RIds.size ();
213   unsigned MinSize = LSize < RSize ? LSize : RSize;
214   for (unsigned i = 0; i != MinSize; ++i)
215     if (LIds[i] != RIds[i])
216       return LIds[i] < RIds[i];
219 void
220 DwarfException::EmitExceptionTable ()
222   SmallVector < const LandingPadInfo *, 64 > LandingPads;
223   std::sort (LandingPads.begin (), LandingPads.end (), PadLT);
224   SmallVector < CallSiteEntry, 64 > CallSites;
225   for (unsigned i = 0, e = CallSites.size (); i < e; ++i)
226     {
227     }