OSDN Git Service

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