2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr53602.C
blob67d9ed848f03a4a67d0a534a4ab1173c239796cf
1 // { dg-do compile }
2 // { dg-options "-std=c++11" }
3 // { dg-additional-options "-Wno-return-type" }
5 namespace std
7   template <class, class>
8   struct pair
9   {
10   };
11   struct input_iterator_tag
12   {
13   };
14   struct forward_iterator_tag : public input_iterator_tag
15   {
16   };
17   template <typename, typename _Tp, typename = _Tp>
18   struct iterator
19   {
20   };
22 namespace __gnu_cxx
24   template <typename _Tp>
25   struct new_allocator
26   {
27     typedef _Tp pointer;
28     typedef _Tp value_type;
29     template <typename _Tp1>
30     struct rebind
31     {
32       typedef new_allocator <_Tp1> other;
33     };
34   };
36 namespace std
38   template <typename _Tp>
39   struct allocator : public __gnu_cxx::new_allocator <_Tp>
40   {
41   };
43 extern "C"
45   struct rtl_String;
46   void rtl_string_release (rtl_String *) throw ();
47   void rtl_string_newFromStr (rtl_String * *, const char *) throw ();
49 namespace std
51   template <typename, typename, typename> struct binary_function;
52   template <typename _Tp>
53   struct equal_to : public binary_function <_Tp, _Tp, bool>
54   {
55   };
57 namespace rtl
59   struct OString
60   {
61     rtl_String * pData;
62     OString (const char *value)
63     {
64       rtl_string_newFromStr (&pData, value);
65     }
66      ~OString ()
67     {
68       rtl_string_release (pData);
69     }
70   };
71   struct OStringHash;
73 namespace boost
75   template <class> struct hash;
76   namespace unordered
77   {
78     template <class T, class = boost::hash <T>, class = std::equal_to <T>, class = std::allocator <T>>class unordered_set;
79   }
80   using boost::unordered::unordered_set;
81   namespace detail
82   {
83     template <bool>
84     struct if_true
85     {
86       template <class, class F>
87       struct then
88       {
89         typedef F type;
90       };
91     };
92   }
93   template <class, class> struct pointer_to_other;
94   template <class T, class U>
95   struct pointer_to_other <T *, U>
96   {
97     typedef U type;
98   };
99   namespace unordered
100   {
101     namespace detail
102     {
103       template <typename T, T> struct integral_constant
104       {
105       };
106       struct choice9
107       {
108         typedef char (&type)[9];
109       };
110       struct choice8:choice9
111       {
112       };
113       struct choice7:choice8
114       {
115       };
116       struct choice6:choice7
117       {
118       };
119       struct choice5:choice6
120       {
121       };
122       struct choice4:choice5
123       {
124       };
125       struct choice3:choice4
126       {
127       };
128       struct choice2:choice3
129       {
130       };
131       struct choice1:choice2
132       {
133       };
134       choice1 choose ();
135       template <typename Alloc, typename T>
136       struct rebind_wrap
137       {
138         typedef typename Alloc::template rebind <T>::other type;
139       };
140       template <typename, typename T2>
141       struct sfinae:T2
142       {
143       };
144       template <typename Tp, typename Default>
145       struct default_type_pointer
146       {
147         template <typename X>
148         static boost::unordered::detail::sfinae <typename X::pointer, choice1> test (choice1);
149         struct DefaultWrap
150         {
151           typedef Default pointer;
152         };
153         enum { value = (1 == sizeof (test <Tp> (choose ()))) };
154         typedef typename boost::detail::if_true <value>::template then <Tp, DefaultWrap>::type::pointer type;
155       };
156       template <typename Tp, typename Default>
157       struct default_type_const_pointer
158       {
159         template <typename>
160         static choice2::type test (choice2);
161         struct DefaultWrap
162         {
163         };
164         enum { value = (1 == sizeof (test <Tp> (choose ()))) };
165         typedef typename boost::detail::if_true <value>::template then <Tp, DefaultWrap> type;
166       };
167       struct default_type_propagate_on_container_swap
168       {
169         struct DefaultWrap
170         {
171         };
172       };
173       template <typename Alloc>
174       struct allocator_traits
175       {
176         typedef typename Alloc::value_type value_type;
177         typedef typename default_type_pointer <Alloc, value_type *>::type pointer;
178         template <typename T>
179         struct pointer_to_other : boost::pointer_to_other <pointer, T>
180         {
181         };
182         typedef typename default_type_const_pointer <Alloc, typename pointer_to_other <value_type>::type>::type const_pointer;
183       };
184     }
185     namespace detail
186     {
187       struct move_tag
188       {
189       };
190       template <typename> struct table;
191       template <typename NodeAlloc>
192       struct node_constructor
193       {
194         void construct_value ()
195         {
196         }
197       };
198       struct ptr_bucket
199       {
200         ptr_bucket ()
201         {
202         }
203       };
204       template <typename A, typename Bucket, typename Node>
205       struct buckets
206       {
207         typedef Node node;
208         typedef Bucket bucket;
209         typedef typename boost::unordered::detail::rebind_wrap <A, node>::type node_allocator;
210         typedef typename boost::unordered::detail::rebind_wrap <A, bucket>::type bucket_allocator;
211         typedef boost::unordered::detail::allocator_traits <node_allocator> node_allocator_traits;
212         typedef boost::unordered::detail::allocator_traits <bucket_allocator> bucket_allocator_traits;
213         typedef typename node_allocator_traits::pointer node_pointer;
214         typedef typename node_allocator_traits::const_pointer const_node_pointer;
215         typedef typename bucket_allocator_traits::pointer bucket_pointer;
216         typedef boost::unordered::detail::node_constructor <node_allocator> node_constructor;
217         bucket_pointer buckets_;
218         unsigned size_;
219         template <typename Types>
220         buckets (boost::unordered::detail::table <Types>, boost::unordered::detail::move_tag) : buckets_ (), size_ ()
221         {
222         }
223       };
224       struct functions
225       {
226       };
227     }
228   }
229   namespace detail
230   {
231     template <class Category, class T, class, class, class>
232     struct iterator_base:std::iterator <Category, T>
233     {
234     };
235   }
236   template <class Category, class T, class Distance, class Pointer = T, class Reference = T>
237   struct iterator:boost::detail::iterator_base <Category, T, Distance, Pointer, Reference>
238   {
239   };
240   namespace unordered
241   {
242     namespace iterator_detail
243     {
244       template <typename, typename NodePointer, typename Value> struct c_iterator:public boost::iterator <std::forward_iterator_tag, Value, int>
245       {
246         friend bool operator== (c_iterator, c_iterator)
247         {
248         }
249       };
250     }
251     namespace detail
252     {
253       template <typename ValueType>
254       struct value_base
255       {
256         typedef ValueType value_type;
257         value_type value ()
258         {
259         }
260       };
261       template <typename Types>
262       struct table:boost::unordered::detail::buckets <typename Types::allocator, typename Types::bucket, typename Types::key_equal>
263       {
264         typedef typename Types::value_type value_type;
265         typedef boost::unordered::detail::buckets <typename Types::allocator, typename Types::bucket, typename Types::node> buckets;
266         typedef typename buckets::node_pointer node_pointer;
267         typedef typename buckets::const_node_pointer const_node_pointer;
268         typedef boost::unordered::iterator_detail::c_iterator <const_node_pointer, node_pointer, value_type> c_iterator;
269         unsigned max_size ()
270         {
271         }
272       };
273       template <typename> struct table_impl;
274       template <typename T>
275       struct ptr_node : boost::unordered::detail::value_base <T>, boost::unordered::detail::ptr_bucket
276       {
277         boost::unordered::detail::ptr_bucket bucket_base;
278         unsigned hash_;
279         ptr_node () : bucket_base (), hash_ ()
280         {
281         }
282       };
283       template <typename A, typename T, typename, typename> struct pick_node2
284       {
285       };
286       template <typename A, typename T> struct pick_node2 <A, T, boost::unordered::detail::ptr_node <T> *, boost::unordered::detail::ptr_bucket *>
287       {
288         typedef boost::unordered::detail::ptr_node <T> node;
289         typedef boost::unordered::detail::ptr_bucket bucket;
290       };
291       template <typename A, typename T> struct pick_node
292       {
293         typedef boost::unordered::detail::allocator_traits <typename boost::unordered::detail::rebind_wrap <A, boost::unordered::detail::ptr_node <T>>::type> tentative_node_traits;
294         typedef boost::unordered::detail::allocator_traits <typename boost::unordered::detail::rebind_wrap <A, boost::unordered::detail::ptr_bucket>::type> tentative_bucket_traits;
295         typedef pick_node2 <A, T, typename tentative_node_traits::pointer, typename tentative_bucket_traits::pointer> pick;
296         typedef typename pick::node node;
297         typedef typename pick::bucket bucket;
298       };
299       template <typename A, typename T, typename H, typename P>
300       struct set
301       {
302         typedef boost::unordered::detail::set <A, T, H, P> types;
303         typedef T value_type;
304         typedef P key_equal;
305         typedef typename boost::unordered::detail::rebind_wrap <A, value_type>::type allocator;
306         typedef boost::unordered::detail::pick_node <allocator, value_type> pick;
307         typedef typename pick::node node;
308         typedef typename pick::bucket bucket;
309         typedef boost::unordered::detail::table_impl <types> table;
310       };
311       template <typename Types>
312       struct table_impl : boost::unordered::detail::table <Types>
313       {
314         typedef boost::unordered::detail::table <Types> table;
315         typedef typename table::node_constructor node_constructor;
316         table_impl () : table ()
317         {
318         }
319         template <class InputIt>
320         void insert_range_impl2 (node_constructor, InputIt)
321         {
322         }
323       };
324     }
325     template <class T, class H, class P, class A>
326     struct unordered_set
327     {
328       typedef T key_type;
329       typedef T value_type;
330       typedef boost::unordered::detail::set <A, T, H, P> types;
331       typedef typename types::table table;
332       typedef typename table::c_iterator const_iterator;
333       typedef typename table::c_iterator iterator;
334       table table_;
335       bool empty ()
336       {
337         return table_.size_;
338       }
339       iterator end ()
340       {
341       }
342       std::pair <iterator, bool> insert (value_type)
343       {
344       }
345       unsigned erase (const key_type &);
346       const_iterator find (const key_type);
347     };
348     template <class T, class H, class P, class A>
349     unsigned unordered_set <T, H, P, A>::erase (const key_type &)
350     {
351     }
352   }
354 using namespace::rtl;
355 namespace skeletonmaker
357   void
358   checkDefaultInterfaces (boost::unordered_set <OString, OStringHash> interfaces,
359                           boost::unordered_set <OStringHash> services, OString)
360   {
361     if (services.empty ())
362       interfaces.erase ("com.sun.star.lang.XServiceInfo");
363     else if (interfaces.find ("com.sun.star.lang.XServiceInfo") == interfaces.end ())
364       interfaces.insert ("com.sun.star.lang.XServiceInfo");
365   }