[Patch SRA] Fix PR66119 by calling get_move_ratio in SRA
[official-gcc.git] / gcc / testsuite / g++.dg / pr57878.C
blob231f9e346b9f8ce77eb482dd2961355063b56e7e
1 /* { dg-do compile { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
2 // { dg-require-effective-target c++11 }
3 /* { dg-options "-O2 -fno-omit-frame-pointer -fPIC" } */
5 typedef int int32;
6 typedef long long int64;
7 typedef unsigned int uint32;
8 typedef unsigned long long uint64;
9 namespace std {
10   typedef __SIZE_TYPE__ size_t;
11   template<class _CharT>
12   struct char_traits;
13   template<typename _Tp>
14   inline _Tp* __addressof(_Tp& __r) noexcept {
15     return reinterpret_cast<_Tp*> (&const_cast<char&>(reinterpret_cast<const volatile char&>(__r)));
16   }
17   template<typename _Tp>
18   struct remove_reference {
19     typedef _Tp type;
20   };
21   template<typename _Tp>
22   constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type& __t) noexcept {
23     return static_cast<_Tp&&>(__t);
24   }
26 typedef __SIZE_TYPE__ size_t;
27 extern "C++" {
28   inline void* operator new(std::size_t, void* __p) noexcept {
29     return __p;
30   }
32 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
33   template<typename _Tp>
34     class new_allocator {
35   public:
36     typedef size_t size_type;
37     typedef _Tp* pointer;
38   };
40 namespace std {
41   template<typename _Tp>
42   using __allocator_base = __gnu_cxx::new_allocator<_Tp>;
43   template<typename _Tp>
44   class allocator
45     : public __allocator_base<_Tp> {
46   public:
47     typedef size_t size_type;
48     template<typename _Tp1>
49     struct rebind {
50       typedef allocator<_Tp1> other;
51     };
52   };
54 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
55   template<typename _CharT, typename _Traits, typename _Alloc>
56     class __sso_string_base;
57   template<typename _CharT, typename _Traits = std::char_traits<_CharT>, typename _Alloc = std::allocator<_CharT>, template <typename, typename, typename> class _Base = __sso_string_base>
58     class __versa_string;
59   template<typename _CharT, typename _Traits, typename _Alloc>
60     struct __vstring_utility {
61     typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
62     template<typename _Alloc1>
63     struct _Alloc_hider
64       : public _Alloc1 {
65       _Alloc_hider(const _Alloc1& __a, _CharT* __ptr)
66   : _Alloc1(__a), _M_p(__ptr) {
67       }
68       _CharT* _M_p;
69     };
70   };
71   template<typename _CharT, typename _Traits, typename _Alloc>
72     class __sso_string_base
73       : protected __vstring_utility<_CharT, _Traits, _Alloc> {
74     typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base;
75     typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type;
76     typedef typename _CharT_alloc_type::size_type size_type;
77   private:
78     typename _Util_Base::template _Alloc_hider<_CharT_alloc_type>
79     _M_dataplus;
80     size_type _M_string_length;
81     enum {
82       _S_local_capacity = 15 };
83     union {
84       _CharT _M_local_data[_S_local_capacity + 1];
85     };
86     template<typename _InIterator>
87     void _M_construct(_InIterator __beg, _InIterator __end);
88   public:
89     size_type _M_max_size() const;
90     _CharT* _M_data() const {
91       return _M_dataplus._M_p;
92     }
93     size_type _M_length() const {
94       return _M_string_length;
95     }
96     __sso_string_base(const __sso_string_base& __rcs);
97     const _CharT_alloc_type& _M_get_allocator() const {
98     }
99   };
100   template<typename _CharT, typename _Traits, typename _Alloc>
101     __sso_string_base<_CharT, _Traits, _Alloc>:: __sso_string_base(const __sso_string_base& __rcs)
102     : _M_dataplus(__rcs._M_get_allocator(), _M_local_data) {
103     _M_construct(__rcs._M_data(), __rcs._M_data() + __rcs._M_length());
104   }
105   template<typename _CharT, typename _Traits, typename _Alloc, template <typename, typename, typename> class _Base>
106     class __versa_string
107       : private _Base<_CharT, _Traits, _Alloc> {
108   };
110 template<typename _CharT, typename _Traits = std::char_traits<_CharT>, typename _Alloc = std::allocator<_CharT> >
111 class basic_string
112   : public __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc> {
114 typedef basic_string<char> string;
115 namespace std __attribute__ ((__visibility__ ("default"))) {
116   template<typename _Alloc, typename _Tp>
117     class __alloctr_rebind_helper {
118   public:
119     static const bool __value = true;
120   };
121   template<typename _Alloc, typename _Tp, bool = __alloctr_rebind_helper<_Alloc, _Tp>::__value>
122     struct __alloctr_rebind;
123   template<typename _Alloc, typename _Tp> struct __alloctr_rebind<_Alloc, _Tp, true>
124   {
125     typedef typename _Alloc::template rebind<_Tp>::other __type;
126   };
127   template<typename _Alloc>
128     struct allocator_traits {
129   private:
130     template<typename _Tp>
131     static typename _Tp::pointer _S_pointer_helper(_Tp*);
132     typedef decltype(_S_pointer_helper((_Alloc*)0)) __pointer;
133   public:
134     typedef __pointer pointer;
135     template<typename _Tp>
136     using rebind_alloc = typename __alloctr_rebind<_Alloc, _Tp>::__type;
137   };
139 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
140   template<typename _Alloc> struct __alloc_traits
141     : std::allocator_traits<_Alloc>
142   {
143     typedef std::allocator_traits<_Alloc> _Base_type;
144     template<typename _Tp>
145     struct rebind {
146       typedef typename _Base_type::template rebind_alloc<_Tp>
147       other;
148     };
149   };
151 namespace std __attribute__ ((__visibility__ ("default"))) {
152   template<typename _T1, typename... _Args>
153     inline void _Construct(_T1* __p, _Args&&... __args) {
154     ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...);
155   }
156   template<typename _Tp, typename _Alloc>
157     struct _Vector_base {
158     typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind<_Tp>::other _Tp_alloc_type;
159     typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer pointer;
160     struct _Vector_impl
161       : public _Tp_alloc_type {
162       pointer _M_start;
163       pointer _M_finish;
164     };
165   public:
166     _Vector_impl _M_impl;
167   };
168   template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
169     class vector
170       : protected _Vector_base<_Tp, _Alloc> {
171     typedef _Vector_base<_Tp, _Alloc> _Base;
172   public:
173     typedef _Tp value_type;
174     typedef typename _Base::pointer pointer;
175     typedef size_t size_type;
176     size_type size() const;
177     void push_back(const value_type& __x) {
178       _M_emplace_back_aux(__x);
179     }
180     template<typename... _Args>
181     void _M_emplace_back_aux(_Args&&... __args);
182     size_type _M_check_len();
183   };
184   template<typename _Tp, typename _Alloc> template<typename... _Args>
185     void vector<_Tp, _Alloc>:: _M_emplace_back_aux(_Args&&... __args) {
186     const size_type __len = _M_check_len();
187     pointer __new_start(static_cast<pointer>(::operator new(__len * sizeof(_Tp))));
188     pointer __new_temp(__new_start + size());
189     ::new((void *)__new_temp) _Tp(std::forward<_Args>(__args)...);
190     pointer __cur = __new_start;
191     pointer __first = this->_M_impl._M_start;
192     pointer __last = this->_M_impl._M_finish;
193     for (;
194          __first != __last;
195          ++__first, ++__cur) std::_Construct(std::__addressof(*__cur), *__first);
196   }
198 using std::vector;
199 class DL {
200 public:
201   struct ChunkId {
202     int64 disk_id;
203     uint64 handle;
204     uint64 version;
205     string capability;
206     ChunkId();
207   };
208   struct ChunkInfo {
209     ChunkId id;
210     uint64 mtime;
211     uint32 length;
212     int32 space_used;
213   };
215 class FDB {
216   void CollectChunk(const DL::ChunkInfo& chunk, const int& location);
217 private:
218   struct ChunkData {
219     int location;
220     DL::ChunkInfo chunk_info;
221   };
222   vector<ChunkData> chunk_data_;
224 void FDB::CollectChunk(const DL::ChunkInfo& chunk, const int& location) {
225   ChunkData chunk_data;
226   chunk_data_.push_back( chunk_data);