1// PR tree-optimize/42337 2// { dg-do compile } 3// { dg-options "-O2" } 4 5template<class _T1, class _T2> struct pair { 6 _T2 second; 7}; 8template<typename _Tp> 9inline const _Tp& max(const _Tp& __a, const _Tp& __b) { } 10 11template<typename _ForwardIterator, typename _Tp, typename _Compare> _ForwardIterator 12lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val, _Compare __comp) { } 13template<class _CharT> struct char_traits {}; 14 15template<typename _Iterator, typename _Container> class __normal_iterator { 16 public: typedef _Iterator iterator_type; 17 __normal_iterator& operator++() { 18 } 19}; 20template<typename _IteratorL, typename _IteratorR, typename _Container> 21inline bool operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { } 22template<typename _Tp> class new_allocator { 23 public: 24 typedef _Tp* pointer; 25 typedef const _Tp* const_pointer; 26}; 27 28template<typename _Tp> 29class allocator: public new_allocator<_Tp> { 30 public: 31 template<typename _Tp1> struct rebind { 32 typedef allocator<_Tp1> other; 33 }; 34}; 35 36template<typename _Arg, typename _Result> struct unary_function { }; 37template<typename _Arg1, typename _Arg2, typename _Result> struct binary_function { }; 38template<typename _Tp> struct less : public binary_function<_Tp, _Tp, bool> { }; 39template<typename _Pair> struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> { }; 40template<typename _Tp> struct _Rb_tree_iterator { 41 typedef _Tp* pointer; 42 pointer operator->() const { 43 } 44}; 45template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc = allocator<_Val> > 46class _Rb_tree { 47 typedef _Val value_type; 48 public: typedef _Rb_tree_iterator<value_type> iterator; 49}; 50template <typename _Key, typename _Tp, typename _Compare = less<_Key>, typename _Alloc = allocator<pair<const _Key, _Tp> > > 51class map { 52 public: typedef _Key key_type; 53 typedef pair<const _Key, _Tp> value_type; 54 typedef _Compare key_compare; 55 private: typedef typename _Alloc::template rebind<value_type>::other _Pair_alloc_type; 56 typedef _Rb_tree<key_type, value_type, _Select1st<value_type>, key_compare, _Pair_alloc_type> _Rep_type; 57 public: typedef typename _Pair_alloc_type::pointer pointer; 58 typedef typename _Rep_type::iterator iterator; 59 iterator find(const key_type& __x) { } 60}; 61 62template<typename _Tp, typename _Alloc> struct _Vector_base { 63 typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type; 64}; 65template<typename _Tp, typename _Alloc = allocator<_Tp> > 66class vector : protected _Vector_base<_Tp, _Alloc> { 67 typedef _Vector_base<_Tp, _Alloc> _Base; 68 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; 69 public: 70 typedef typename _Tp_alloc_type::pointer pointer; 71 typedef typename _Tp_alloc_type::const_pointer const_pointer; 72 typedef __normal_iterator<pointer, vector> iterator; 73 typedef __normal_iterator<const_pointer, vector> const_iterator; 74 iterator begin() { } 75 const_iterator begin() const { } 76 const_iterator end() const { } 77 unsigned long size() const { } 78}; 79 80class SSC { 81 public: 82 SSC () {} 83 SSC (const int& cs); 84}; 85extern int flag; 86 87struct TP { 88 const int cl_; 89 const vector<int> &its_; 90 int max_s_; 91 }; 92 93double foo(TP *p); 94map<int, int> cs_; 95 96template <typename T> class vector32 { 97 public: 98 typedef T& reference; 99 typedef T* iterator; 100 typedef const T* const_iterator; 101 iterator begin() { return data_; } 102 iterator end() { return data_ + size_; } 103 long unsigned int size() const { return size_; } 104 T* data_; 105 unsigned size_; 106}; 107 108struct SF : public pair<unsigned long long, double> { }; 109 110template<typename KEY, typename VALUE> class SFVT { 111 private: typedef vector32<SF> Container; 112 typedef typename Container::const_iterator CI; 113 mutable Container v_; 114 mutable bool sorted_; 115 struct Cmp : public binary_function<SF, SF, bool> { 116 }; 117 __attribute__((always_inline)) VALUE IS(const SFVT &sfv) const { 118 if (sfv.v_.size() < v_.size()) { 119 return sfv.IS(*this); 120 } 121 else { 122 VALUE sum = 0.0; 123 CI beg = sfv.v_.begin(); 124 CI end = sfv.v_.end(); 125 for (CI i = v_.begin(); 126 i != v_.end(); 127 ++i) { beg = lower_bound(beg, end, *i, Cmp()); if (beg == end) { return sum; } } 128 } 129 } 130 public: explicit SFVT(const int capacity = 0) : sorted_(true) { } 131 long unsigned int size() const { } 132 __attribute__((always_inline)) VALUE DP(const SFVT &sfv) const { 133 return IS(sfv); 134 } 135}; 136class SFV : public SFVT<unsigned long long, double> { }; 137 138class Edge; 139extern int flag2; 140 141double foo(TP *p) { 142 int nbests_requested = max(p->max_s_, flag); 143 map<int, int>::iterator it = cs_.find(p->cl_); 144 int* c = &it->second; 145 for (vector<int>::const_iterator iter = p->its_.begin(); 146 iter != p->its_.end(); 147 ++iter) { 148 } 149 vector<int*> fb; 150 vector<double> w; 151 int *hg = 0; 152 if (flag2 == 10) { 153 hg = &flag2; 154 } 155 int nr = 0; 156 for (vector<int*>::iterator iter = fb.begin(); 157 (iter != fb.end() && nr < nbests_requested); 158 ++iter) { 159 } 160 if (hg) { 161 SFV s_weights; 162 for (int i = 0; 163 i < w.size(); 164 ++i) { 165 } 166 SFV uw; 167 for (int i = 0, j = 0; 168 i < uw.size() && j < s_weights.size(); 169 ) { 170 } 171 const double tc = uw.DP(s_weights); 172 } 173} 174