Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/variadic98.C

raw
1 // PR c++/42358
2 // { dg-do assemble { target c++11 } }
3 // { dg-additional-options "-Wno-return-type" }
4
5 typedef __PTRDIFF_TYPE__ ptrdiff_t;
6 typedef __SIZE_TYPE__ size_t;
7 namespace std __attribute__ ((__visibility__ ("default"))) {
8 using ::size_t;
9 }
10 namespace std __attribute__ ((__visibility__ ("default"))) {
11 struct __sfinae_types {
12 typedef char __one;
13 typedef struct {
14 } __two;
15 };
16 template<typename _Tp, _Tp __v> struct integral_constant {
17 static const _Tp value = __v;
18 typedef _Tp value_type;
19 typedef integral_constant<_Tp, __v> type;
20 };
21 typedef integral_constant<bool, false> false_type;
22 template<typename> struct remove_cv;
23 template<typename> struct __is_void_helper : public false_type {
24 };
25 template<typename _Tp> struct is_void : public integral_constant<bool, (__is_void_helper<typename remove_cv<_Tp>::type>::value)> {
26 };
27 template<typename> struct is_array : public false_type {
28 };
29 template<typename> struct is_function : public false_type {
30 };
31 template<typename, unsigned _Uint = 0> struct extent : public integral_constant<std::size_t, 0> {
32 };
33 template<typename _Tp> struct remove_const {
34 typedef _Tp type;
35 };
36 template<typename _Tp> struct remove_volatile {
37 typedef _Tp type;
38 };
39 template<typename _Tp> struct remove_cv {
40 typedef typename remove_const<typename remove_volatile<_Tp>::type>::type type;
41 };
42 template<typename> struct is_lvalue_reference : public false_type {
43 };
44 template<typename> struct is_rvalue_reference : public false_type {
45 };
46 template<typename _Tp> struct is_reference : public integral_constant<bool, (is_lvalue_reference<_Tp>::value || is_rvalue_reference<_Tp>::value)> {
47 };
48 template<typename _Tp> struct remove_reference {
49 typedef _Tp type;
50 };
51 template<typename _Tp, bool = !is_reference<_Tp>::value && !is_void<_Tp>::value> struct __add_rvalue_reference_helper {
52 typedef _Tp type;
53 };
54 template<typename _Tp> struct add_rvalue_reference : public __add_rvalue_reference_helper<_Tp> {
55 };
56 template<typename _Tp> typename add_rvalue_reference<_Tp>::type declval();
57 template<typename _From, typename _To, bool = (is_void<_From>::value || is_void<_To>::value || is_function<_To>::value || is_array<_To>::value)> struct __is_convertible_helper {
58 };
59 template<typename _From, typename _To> struct __is_convertible_helper<_From, _To, false> : public __sfinae_types {
60 static __one __test(_To);
61 static __two __test(...);
62 static const bool __value = sizeof(__test(declval<_From>())) == 1;
63 };
64 template<typename _From, typename _To> struct is_convertible : public integral_constant<bool, __is_convertible_helper<_From, _To>::__value> {
65 };
66 template<bool, typename _Tp = void> struct enable_if {
67 };
68 template<typename _Tp> struct enable_if<true, _Tp> {
69 typedef _Tp type;
70 };
71 template<typename _Tp> struct identity {
72 typedef _Tp type;
73 };
74 template<typename _Tp> inline typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp&&>::type forward(typename std::identity<_Tp>::type& __t) {
75 }
76 template<typename _Tp> inline typename enable_if<is_lvalue_reference<_Tp>::value, _Tp>::type forward(typename std::identity<_Tp>::type __t) {
77 }
78 template<typename _Tp> inline typename std::remove_reference<_Tp>::type&& move(_Tp&& __t) {
79 }
80 template<class _T1, class _T2> struct pair {
81 typedef _T1 first_type;
82 typedef _T2 second_type;
83 _T1 first;
84 _T2 second;
85 template<class _U1, class = typename std::enable_if<std::is_convertible<_U1, _T1>::value>::type> pair(_U1&& __x, const _T2& __y) : first(std::forward<_U1>(__x)), second(__y) {
86 }
87 template<class _U2, class = typename std::enable_if<std::is_convertible<_U2, _T2>::value>::type> pair(const _T1& __x, _U2&& __y) : first(__x), second(std::forward<_U2>(__y)) {
88 }
89 template<class _U1, class _U2, class = typename std::enable_if<std::is_convertible<_U1, _T1>::value && std::is_convertible<_U2, _T2>::value>::type> pair(_U1&& __x, _U2&& __y) : first(std::forward<_U1>(__x)), second(std::forward<_U2>(__y)) {
90 }
91 template<class _U1, class _U2> pair(pair<_U1, _U2>&& __p) : first(std::move(__p.first)), second(std::move(__p.second)) {
92 }
93 template<class _U1, class _U2> pair& operator=(pair<_U1, _U2>&& __p) {
94 }
95 };
96 struct input_iterator_tag {
97 };
98 struct output_iterator_tag {
99 };
100 struct forward_iterator_tag : public input_iterator_tag {
101 };
102 struct bidirectional_iterator_tag : public forward_iterator_tag {
103 };
104 template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, typename _Pointer = _Tp*, typename _Reference = _Tp&> struct iterator {
105 typedef _Category iterator_category;
106 typedef _Tp value_type;
107 typedef _Distance difference_type;
108 typedef _Pointer pointer;
109 typedef _Reference reference;
110 };
111 template<typename _Iterator> struct iterator_traits {
112 typedef typename _Iterator::iterator_category iterator_category;
113 typedef typename _Iterator::value_type value_type;
114 typedef typename _Iterator::difference_type difference_type;
115 typedef typename _Iterator::pointer pointer;
116 typedef typename _Iterator::reference reference;
117 };
118 template<typename _Iter> inline typename iterator_traits<_Iter>::iterator_category __iterator_category(const _Iter&) {
119 }
120 template<typename _InputIterator> inline typename iterator_traits<_InputIterator>::difference_type __distance(_InputIterator __first, _InputIterator __last, input_iterator_tag) {
121 }
122 template<typename _InputIterator> inline typename iterator_traits<_InputIterator>::difference_type distance(_InputIterator __first, _InputIterator __last) {
123 return std::__distance(__first, __last, std::__iterator_category(__first));
124 }
125 template<typename _Iterator> class reverse_iterator : public iterator<typename iterator_traits<_Iterator>::iterator_category, typename iterator_traits<_Iterator>::value_type, typename iterator_traits<_Iterator>::difference_type, typename iterator_traits<_Iterator>::pointer, typename iterator_traits<_Iterator>::reference> {
126 };
127 template<typename _Container> class back_insert_iterator : public iterator<output_iterator_tag, void, void, void, void> {
128 };
129 }
130 namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
131 template<typename _Tp> class new_allocator {
132 public:
133 typedef size_t size_type;
134 typedef ptrdiff_t difference_type;
135 typedef _Tp* pointer;
136 typedef const _Tp* const_pointer;
137 typedef _Tp& reference;
138 typedef const _Tp& const_reference;
139 typedef _Tp value_type;
140 new_allocator() throw() {
141 }
142 new_allocator(const new_allocator&) throw() {
143 }
144 template<typename _Tp1> new_allocator(const new_allocator<_Tp1>&) throw() {
145 }
146 template<typename... _Args> void construct(pointer __p, _Args&&... __args) {
147 }
148 };
149 }
150 namespace std __attribute__ ((__visibility__ ("default"))) {
151 template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> {
152 public:
153 typedef size_t size_type;
154 typedef ptrdiff_t difference_type;
155 typedef _Tp* pointer;
156 typedef const _Tp* const_pointer;
157 typedef _Tp& reference;
158 typedef const _Tp& const_reference;
159 typedef _Tp value_type;
160 template<typename _Tp1> struct rebind {
161 typedef allocator<_Tp1> other;
162 };
163 allocator() throw() {
164 }
165 template<typename _Tp1> allocator(const allocator<_Tp1>&) throw() {
166 }
167 };
168 extern template class allocator<char>;
169 extern template class allocator<wchar_t>;
170 template<typename _Arg, typename _Result> struct unary_function {
171 typedef _Arg argument_type;
172 typedef _Result result_type;
173 };
174 template<typename _Arg1, typename _Arg2, typename _Result> struct binary_function {
175 typedef _Arg1 first_argument_type;
176 typedef _Arg2 second_argument_type;
177 typedef _Result result_type;
178 };
179 template<typename _Tp> struct less : public binary_function<_Tp, _Tp, bool> {
180 bool operator()(const _Tp& __x, const _Tp& __y) const {
181 return true;
182 }
183 };
184 template<typename _Pair> struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> {
185 const typename _Pair::first_type& operator()(const _Pair& __x) const {
186 }
187 };
188 struct _Rb_tree_node_base {
189 typedef _Rb_tree_node_base* _Base_ptr;
190 typedef const _Rb_tree_node_base* _Const_Base_ptr;
191 };
192 template<typename _Val> struct _Rb_tree_node : public _Rb_tree_node_base {
193 typedef _Rb_tree_node<_Val>* _Link_type;
194 _Val _M_value_field;
195 template<typename... _Args> _Rb_tree_node(_Args&&... __args) : _Rb_tree_node_base(), _M_value_field(std::forward<_Args>(__args)...) {
196 }
197 };
198 template<typename _Tp> struct _Rb_tree_iterator {
199 typedef _Tp value_type;
200 typedef _Tp& reference;
201 typedef _Tp* pointer;
202 typedef bidirectional_iterator_tag iterator_category;
203 typedef ptrdiff_t difference_type;
204 typedef _Rb_tree_iterator<_Tp> _Self;
205 typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;
206 typedef _Rb_tree_node<_Tp>* _Link_type;
207 _Base_ptr _M_node;
208 };
209 template<typename _Tp> struct _Rb_tree_const_iterator {
210 typedef _Tp value_type;
211 typedef const _Tp& reference;
212 typedef const _Tp* pointer;
213 typedef _Rb_tree_iterator<_Tp> iterator;
214 typedef bidirectional_iterator_tag iterator_category;
215 typedef ptrdiff_t difference_type;
216 typedef _Rb_tree_const_iterator<_Tp> _Self;
217 typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr;
218 typedef const _Rb_tree_node<_Tp>* _Link_type;
219 explicit _Rb_tree_const_iterator(_Link_type __x) : _M_node(__x) {
220 }
221 _Rb_tree_const_iterator(const iterator& __it) : _M_node(__it._M_node) {
222 }
223 _Base_ptr _M_node;
224 };
225 template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc = allocator<_Val> > class _Rb_tree {
226 typedef typename _Alloc::template rebind<_Rb_tree_node<_Val> >::other _Node_allocator;
227 typedef _Rb_tree_node_base* _Base_ptr;
228 typedef const _Rb_tree_node_base* _Const_Base_ptr;
229 public:
230 typedef _Key key_type;
231 typedef _Val value_type;
232 typedef value_type* pointer;
233 typedef const value_type* const_pointer;
234 typedef value_type& reference;
235 typedef const value_type& const_reference;
236 typedef _Rb_tree_node<_Val>* _Link_type;
237 typedef const _Rb_tree_node<_Val>* _Const_Link_type;
238 typedef size_t size_type;
239 typedef ptrdiff_t difference_type;
240 typedef _Alloc allocator_type;
241 _Node_allocator& _M_get_Node_allocator() {
242 }
243 _Link_type _M_get_node() {
244 }
245 template<typename... _Args> _Link_type _M_create_node(_Args&&... __args) {
246 _Link_type __tmp = _M_get_node();
247 try {
248 _M_get_Node_allocator().construct(__tmp, std::forward<_Args>(__args)...);
249 }
250 catch(...) {
251 }
252 }
253 template<typename _Key_compare, bool _Is_pod_comparator = __is_pod(_Key_compare)> struct _Rb_tree_impl : public _Node_allocator {
254 _Key_compare _M_key_compare;
255 _Rb_tree_node_base _M_header;
256 size_type _M_node_count;
257 _Rb_tree_impl(const _Key_compare& __comp, const _Node_allocator& __a) : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), _M_node_count(0) {
258 }
259 void _M_initialize() {
260 }
261 };
262 _Rb_tree_impl<_Compare> _M_impl;
263 _Base_ptr& _M_rightmost() {
264 }
265 _Link_type _M_begin() {
266 }
267 _Link_type _M_end() {
268 }
269 _Const_Link_type _M_end() const {
270 }
271 static _Link_type _S_right(_Base_ptr __x) {
272 }
273 static const_reference _S_value(_Const_Base_ptr __x) {
274 }
275 static const _Key& _S_key(_Const_Base_ptr __x) {
276 return _KeyOfValue()(_S_value(__x));
277 }
278 typedef _Rb_tree_iterator<value_type> iterator;
279 typedef _Rb_tree_const_iterator<value_type> const_iterator;
280 typedef std::reverse_iterator<iterator> reverse_iterator;
281 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
282 iterator _M_insert_(_Const_Base_ptr __x, _Const_Base_ptr __y, const value_type& __v);
283 iterator _M_insert_lower(_Base_ptr __x, _Base_ptr __y, const value_type& __v);
284 iterator _M_insert_equal_lower(const value_type& __x);
285 iterator _M_lower_bound(_Link_type __x, _Link_type __y, const _Key& __k);
286 iterator _M_upper_bound(_Link_type __x, _Link_type __y, const _Key& __k);
287 _Rb_tree(const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_impl(__comp, __a) {
288 }
289 iterator end() {
290 }
291 iterator _M_insert_equal_(const_iterator __position, const value_type& __x);
292 template<typename _InputIterator> void _M_insert_unique(_InputIterator __first, _InputIterator __last);
293 template<typename _InputIterator> void _M_insert_equal(_InputIterator __first, _InputIterator __last);
294 size_type count(const key_type& __k) const;
295 pair<iterator, iterator> equal_range(const key_type& __k);
296 pair<const_iterator, const_iterator> equal_range(const key_type& __k) const;
297 };
298 template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_insert_(_Const_Base_ptr __x, _Const_Base_ptr __p, const _Val& __v) {
299 _Link_type __z = _M_create_node(__v);
300 }
301 template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_insert_lower(_Base_ptr __x, _Base_ptr __p, const _Val& __v) {
302 _Link_type __z = _M_create_node(__v);
303 }
304 template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_insert_equal_lower(const _Val& __v) {
305 _Link_type __x = _M_begin();
306 _Link_type __y = _M_end();
307 return _M_insert_lower(__x, __y, __v);
308 }
309 template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> pair<typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator, typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator> _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: equal_range(const _Key& __k) {
310 _Link_type __x = _M_begin();
311 _Link_type __y = _M_end();
312 while (__x != 0) {
313 if (_M_impl._M_key_compare(_S_key(__x), __k)) __x = _S_right(__x);
314 else {
315 _Link_type __xu(__x), __yu(__y);
316 return pair<iterator, iterator>(_M_lower_bound(__x, __y, __k), _M_upper_bound(__xu, __yu, __k));
317 }
318 }
319 }
320 template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> pair<typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator, typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator> _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: equal_range(const _Key& __k) const {
321 _Const_Link_type __y = _M_end();
322 return pair<const_iterator, const_iterator>(const_iterator(__y), const_iterator(__y));
323 }
324 template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: _M_insert_equal_(const_iterator __position, const _Val& __v) {
325 if (__position._M_node == _M_end()) {
326 if (__position._M_node == _M_rightmost()) return _M_insert_(0, _M_rightmost(), __v);
327 else return _M_insert_equal_lower(__v);
328 }
329 }
330 template<typename _Key, typename _Val, typename _KoV, typename _Cmp, typename _Alloc> template<class _II> void _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>:: _M_insert_equal(_II __first, _II __last) {
331 for (;
332 __first != __last;
333 ++__first) _M_insert_equal_(end(), *__first);
334 }
335 template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc> typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>:: count(const _Key& __k) const {
336 pair<const_iterator, const_iterator> __p = equal_range(__k);
337 const size_type __n = std::distance(__p.first, __p.second);
338 }
339 template<class _E> class initializer_list {
340 public:
341 typedef _E value_type;
342 typedef const _E& reference;
343 typedef const _E& const_reference;
344 typedef size_t size_type;
345 typedef const _E* iterator;
346 typedef const _E* const_iterator;
347 iterator _M_array;
348 size_type _M_len;
349 initializer_list(const_iterator __a, size_type __l) : _M_array(__a), _M_len(__l) {
350 }
351 const_iterator begin() const {
352 }
353 const_iterator end() const {
354 }
355 };
356 template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > > class multimap {
357 typedef _Key key_type;
358 typedef _Tp mapped_type;
359 typedef std::pair<const _Key, _Tp> value_type;
360 typedef _Compare key_compare;
361 typedef _Alloc allocator_type;
362 typedef typename _Alloc::value_type _Alloc_value_type;
363 typedef typename _Alloc::template rebind<value_type>::other _Pair_alloc_type;
364 typedef _Rb_tree<key_type, value_type, _Select1st<value_type>, key_compare, _Pair_alloc_type> _Rep_type;
365 _Rep_type _M_t;
366 public:
367 typedef typename _Pair_alloc_type::pointer pointer;
368 typedef typename _Pair_alloc_type::const_pointer const_pointer;
369 typedef typename _Pair_alloc_type::reference reference;
370 typedef typename _Pair_alloc_type::const_reference const_reference;
371 typedef typename _Rep_type::iterator iterator;
372 typedef typename _Rep_type::const_iterator const_iterator;
373 typedef typename _Rep_type::size_type size_type;
374 typedef typename _Rep_type::difference_type difference_type;
375 typedef typename _Rep_type::reverse_iterator reverse_iterator;
376 typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;
377 multimap(initializer_list<value_type> __l, const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) : _M_t(__comp, __a) {
378 _M_t._M_insert_equal(__l.begin(), __l.end());
379 }
380 template<typename _InputIterator> multimap(_InputIterator __first, _InputIterator __last) : _M_t() {
381 }
382 template<typename _InputIterator> multimap(_InputIterator __first, _InputIterator __last, const _Compare& __comp, const allocator_type& __a = allocator_type()) : _M_t(__comp, __a) {
383 }
384 template<typename _InputIterator> void insert(_InputIterator __first, _InputIterator __last) {
385 }
386 size_type count(const key_type& __x) const {
387 return _M_t.count(__x);
388 }
389 std::pair<iterator, iterator> equal_range(const key_type& __x) {
390 return _M_t.equal_range(__x);
391 }
392 template<typename _K1, typename _T1, typename _C1, typename _A1> friend bool operator==(const multimap<_K1, _T1, _C1, _A1>&, const multimap<_K1, _T1, _C1, _A1>&);
393 template<typename _K1, typename _T1, typename _C1, typename _A1> friend bool operator<(const multimap<_K1, _T1, _C1, _A1>&, const multimap<_K1, _T1, _C1, _A1>&);
394 };
395 }
396 extern "C" {
397 extern void __assert_fail (__const char *__assertion, __const char *__file, unsigned int __line, __const char *__function) throw () __attribute__ ((__noreturn__));
398 }
399 using namespace std;
400 int test01() {
401 typedef multimap<int,double> Container;
402 typedef Container::iterator iterator;
403 typedef pair<iterator,iterator> itpair;
404 Container m({
405 {
406 1, 1.0 }
407 }
408 );
409 itpair ip = m.equal_range(1);
410 ((distance(ip.first, ip.second) == 3) ? static_cast<void> (0) : __assert_fail ("distance(ip.first, ip.second) == 3", "/home/richard/src/trunk/libstdc++-v3/testsuite/23_containers/multimap/init-list.cc", 36, __PRETTY_FUNCTION__));
411 ((m.count(7) == 2) ? static_cast<void> (0) : __assert_fail ("m.count(7) == 2", "/home/richard/src/trunk/libstdc++-v3/testsuite/23_containers/multimap/init-list.cc", 54, __PRETTY_FUNCTION__));
412 }