OSDN Git Service

Add missing test from last commit
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / tree-ssa / pr27291.C
1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3
4 namespace std
5 {
6   template < class _T1, class _T2 > struct pair
7   {
8   };
9 }
10 extern "C"
11 {
12   extern "C"
13   {
14     typedef int int32_t __attribute__ ((__mode__ (__SI__)));
15     struct _pthread_fastlock
16     {
17     }
18     pthread_mutexattr_t;
19   }
20 }
21 namespace std
22 {
23   struct __numeric_limits_base
24   {
25   };
26     template < typename _Tp >
27     struct numeric_limits:public __numeric_limits_base
28   {
29     static const bool is_integer = true;
30   };
31 };
32 typedef unsigned int uint32_t;
33 namespace std
34 {
35   template < typename _Alloc > class allocator;
36   template < class _CharT > struct char_traits;
37     template < typename _CharT, typename _Traits =
38     char_traits < _CharT >, typename _Alloc =
39     allocator < _CharT > >class basic_string;
40   typedef basic_string < char >string;
41 }
42 namespace __gnu_cxx
43 {
44   template < typename _Tp > class new_allocator
45   {
46   };
47 }
48 namespace std
49 {
50   template < typename _Tp > class allocator:public __gnu_cxx::new_allocator <
51     _Tp >
52   {
53   };
54   template < typename _CharT, typename _Traits,
55     typename _Alloc > class basic_string
56   {
57   public:inline basic_string ();
58     basic_string (const _CharT * __s, const _Alloc & __a = _Alloc ());
59   };
60 }
61 namespace boost
62 {
63   template < class T > class integer_traits:public std::numeric_limits < T >
64   {
65   };
66   namespace detail
67   {
68     template < class T, T min_val, T max_val > class integer_traits_base
69     {
70     };
71   }
72   template <> class integer_traits < int >:public std::numeric_limits < int >,
73     public detail::integer_traits_base < int, (-2147483647 - 1), 2147483647 >
74   {
75   };
76   namespace random
77   {
78     template < class IntType, IntType m > class const_mod
79     {
80     public:static IntType add (IntType x, IntType c)
81       {
82       }
83       static IntType mult (IntType a, IntType x)
84       {
85         return mult_schrage (a, x);
86       }
87       static IntType mult_add (IntType a, IntType x, IntType c)
88       {
89         return add (mult (a, x), c);
90       }
91       static IntType mult_schrage (IntType a, IntType value)
92       {
93         for (;;)
94           {
95             if (value > 0)
96               break;
97             value += m;
98           }
99       }
100     };
101     template < class IntType, IntType a, IntType c, IntType m,
102       IntType val > class linear_congruential
103     {
104     public:typedef IntType result_type;
105       static const IntType modulus = m;
106     explicit linear_congruential (IntType x0 = 1):_modulus (modulus),
107         _x (_modulus ? (x0 % _modulus) :
108             x0)
109       {
110       }
111       IntType operator    () ()
112       {
113         _x = const_mod < IntType, m >::mult_add (a, _x, c);
114       }
115     private:IntType _modulus;
116       IntType _x;
117     };
118   }
119   typedef random::linear_congruential < int32_t, 16807, 0, 2147483647,
120     1043618065 > minstd_rand0;
121   namespace random
122   {
123     namespace detail
124     {
125       template < class T > struct ptr_helper
126       {
127         typedef T value_type;
128         typedef T & reference_type;
129         typedef const T & rvalue_type;
130         static reference_type ref (T & r)
131         {
132         }
133       };
134         template < class T > struct ptr_helper <T & >
135       {
136         typedef T value_type;
137         typedef T & rvalue_type;
138       };
139     }
140   }
141   template < class UniformRandomNumberGenerator, class RealType =
142     double >class uniform_01
143   {
144   public:typedef UniformRandomNumberGenerator base_type;
145     typedef RealType result_type;
146     explicit uniform_01 (base_type rng):_rng (rng),
147       _factor (result_type (1) /
148                (result_type ((_rng.max) () - (_rng.min) ()) +
149                 result_type (std::numeric_limits <
150                              base_result >::is_integer ? 1 : 0)))
151     {
152     }
153     result_type operator    () ()
154     {
155       return result_type (_rng () - (_rng.min) ()) * _factor;
156     }
157   private:typedef typename base_type::result_type base_result;
158     base_type _rng;
159     result_type _factor;
160   };
161   namespace random
162   {
163     namespace detail
164     {
165       template < class UniformRandomNumberGenerator >
166         class pass_through_engine
167       {
168       private:typedef ptr_helper < UniformRandomNumberGenerator >
169           helper_type;
170       public:typedef typename helper_type::value_type base_type;
171         typedef typename base_type::result_type result_type;
172         explicit pass_through_engine (UniformRandomNumberGenerator
173                                       rng):_rng (static_cast <
174                                                  typename helper_type::
175                                                  rvalue_type > (rng))
176         {
177         }
178         result_type min () const
179         {
180         }
181         result_type max () const
182         {
183         }
184         base_type & base ()
185         {
186         }
187         result_type operator    () ()
188         {
189           return base ()();
190         }
191       private:UniformRandomNumberGenerator _rng;
192       };
193     }
194     template < class RealType, int w, unsigned int p,
195       unsigned int q > class lagged_fibonacci_01
196     {
197     public:typedef RealType result_type;
198       static const unsigned int long_lag = p;
199         lagged_fibonacci_01 ()
200       {
201         seed ();
202       }
203     public:void seed (uint32_t value = 331u)
204       {
205         minstd_rand0 intgen (value);
206         seed (intgen);
207       }
208       template < class Generator > void seed (Generator & gen)
209       {
210         typedef detail::pass_through_engine < Generator & >ref_gen;
211         uniform_01 < ref_gen, RealType > gen01 =
212           uniform_01 < ref_gen, RealType > (ref_gen (gen));
213         for (unsigned int j = 0; j < long_lag; ++j)
214           x[j] = gen01 ();
215       }
216       RealType x[long_lag];
217     };
218   }
219   typedef random::lagged_fibonacci_01 < double, 48, 607,
220     273 > lagged_fibonacci607;
221   namespace random
222   {
223     namespace detail
224     {
225       template < bool have_int, bool want_int > struct engine_helper;
226         template <> struct engine_helper <true, true >
227       {
228         template < class Engine, class DistInputType > struct impl
229         {
230           typedef pass_through_engine < Engine > type;
231         };
232       };
233     }
234   }
235   template < class Engine, class Distribution > class variate_generator
236   {
237   private:typedef random::detail::pass_through_engine < Engine >
238       decorated_engine;
239   public:typedef typename decorated_engine::base_type engine_value_type;
240     typedef Distribution distribution_type;
241   variate_generator (Engine e, Distribution d):_eng (decorated_engine (e)),
242       _dist (d)
243     {
244     }
245   private:enum
246     {
247       have_int =
248         std::numeric_limits <
249         typename decorated_engine::result_type >::is_integer, want_int =
250         std::numeric_limits < typename Distribution::input_type >::is_integer
251     };
252     typedef typename random::detail::engine_helper < have_int,
253       want_int >::template impl < decorated_engine,
254       typename Distribution::input_type >::type internal_engine_type;
255     internal_engine_type _eng;
256     distribution_type _dist;
257   };
258   template < class RealType = double >class uniform_real
259   {
260   public:typedef RealType input_type;
261   };
262 }
263 namespace alps
264 {
265   class BufferedRandomNumberGeneratorBase
266   {
267   };
268     template < class RNG >
269     class BufferedRandomNumberGenerator:public
270     BufferedRandomNumberGeneratorBase
271   {
272   public: BufferedRandomNumberGenerator ():rng_ (), gen_ (rng_,
273                    boost::
274                    uniform_real <> ())
275     {
276     }
277   protected:  RNG rng_;
278     boost::variate_generator < RNG &, boost::uniform_real <> >gen_;
279   };
280 }
281 namespace boost
282 {
283   namespace detail
284   {
285     class sp_counted_base
286     {
287     };
288     class shared_count
289     {
290     private:sp_counted_base * pi_;
291     public:shared_count ():pi_ (0)
292       {
293       }
294       template < class Y > explicit shared_count (Y * p):pi_ (0)
295       {
296       }
297     };
298   }
299   template < class T > class shared_ptr
300   {
301   public:typedef T element_type;
302   template < class Y > explicit shared_ptr (Y * p):px (p), pn (p)
303     {
304     }
305     T *px;
306     detail::shared_count pn;
307   };
308 }
309 namespace std
310 {
311   template < typename _Key, typename _Tp, typename _Compare =
312     std::allocator < std::pair < const _Key, _Tp > > > class map
313   {
314   public:typedef _Key key_type;
315     typedef _Tp mapped_type;
316       mapped_type & operator[] (const key_type & __k)
317     {
318     }
319   };
320 }
321 namespace alps
322 {
323   namespace detail
324   {
325     template < class BASE > class abstract_creator
326     {
327     public:typedef BASE base_type;
328       virtual base_type *create () const = 0;
329     };
330       template < class BASE,
331       class T > class creator:public abstract_creator < BASE >
332     {
333     public:typedef BASE base_type;
334       base_type *create () const
335       {
336         return new T ();
337       }
338     };
339   }
340   template < class KEY, class BASE > class factory
341   {
342   public:typedef BASE base_type;
343     typedef KEY key_type;
344     typedef boost::shared_ptr < detail::abstract_creator < base_type >
345       >pointer_type;
346     template < class T > bool register_type (key_type k)
347     {
348       creators_[k] = pointer_type (new detail::creator < BASE, T > ());
349     }
350   private:typedef std::map < key_type, pointer_type > map_type;
351     map_type creators_;
352   };
353   class RNGFactory:public factory < std::string,
354     BufferedRandomNumberGeneratorBase >
355   {
356   public:RNGFactory ();
357   };
358 }
359 alps::RNGFactory::RNGFactory ()
360 {
361   register_type < BufferedRandomNumberGenerator < boost::lagged_fibonacci607 >
362     >("lagged_fibonacci607");
363 }