From 6323b34eeb914d6b63cb4dce5212f13f1e345370 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 10 May 2005 01:58:19 +0000 Subject: [PATCH] re PR libstdc++/18604 (Use of unqualified names conflict with names in global namespace) 2005-05-09 Paolo Carlini Giovanni Bajo PR libstdc++/18604 * include/bits/deque.tcc: Fully qualify names from namespace std. * include/bits/stl_bvector.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/vector.tcc: Likewise. * include/std/std_bitset.h: Likewise. * testsuite/23_containers/bitset/18604.cc: New. * testsuite/23_containers/deque/18604.cc: Likewise. * testsuite/23_containers/list/18604.cc: Likewise. * testsuite/23_containers/map/18604.cc: Likewise. * testsuite/23_containers/set/18604.cc: Likewise. * testsuite/23_containers/vector/18604.cc: Likewise. Co-Authored-By: Giovanni Bajo From-SVN: r99499 --- libstdc++-v3/ChangeLog | 22 +++++++ libstdc++-v3/include/bits/deque.tcc | 12 ++-- libstdc++-v3/include/bits/stl_bvector.h | 15 +++-- libstdc++-v3/include/bits/stl_deque.h | 42 ++++++------ libstdc++-v3/include/bits/stl_list.h | 32 ++++----- libstdc++-v3/include/bits/stl_map.h | 16 ++--- libstdc++-v3/include/bits/stl_multimap.h | 14 ++-- libstdc++-v3/include/bits/stl_multiset.h | 10 +-- libstdc++-v3/include/bits/stl_set.h | 17 ++--- libstdc++-v3/include/bits/stl_vector.h | 26 ++++---- libstdc++-v3/include/bits/vector.tcc | 10 +-- libstdc++-v3/include/std/std_bitset.h | 65 +++++++++++-------- .../testsuite/23_containers/bitset/18604.cc | 41 ++++++++++++ .../testsuite/23_containers/deque/18604.cc | 41 ++++++++++++ .../testsuite/23_containers/list/18604.cc | 41 ++++++++++++ .../testsuite/23_containers/map/18604.cc | 41 ++++++++++++ .../testsuite/23_containers/set/18604.cc | 42 ++++++++++++ .../testsuite/23_containers/vector/18604.cc | 41 ++++++++++++ 18 files changed, 404 insertions(+), 124 deletions(-) create mode 100644 libstdc++-v3/testsuite/23_containers/bitset/18604.cc create mode 100644 libstdc++-v3/testsuite/23_containers/deque/18604.cc create mode 100644 libstdc++-v3/testsuite/23_containers/list/18604.cc create mode 100644 libstdc++-v3/testsuite/23_containers/map/18604.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/18604.cc create mode 100644 libstdc++-v3/testsuite/23_containers/vector/18604.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 12052da8a56..89bfcbbee5c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,25 @@ +2005-05-09 Paolo Carlini + Giovanni Bajo + + PR libstdc++/18604 + * include/bits/deque.tcc: Fully qualify names from namespace std. + * include/bits/stl_bvector.h: Likewise. + * include/bits/stl_deque.h: Likewise. + * include/bits/stl_list.h: Likewise. + * include/bits/stl_map.h: Likewise. + * include/bits/stl_multimap.h: Likewise. + * include/bits/stl_multiset.h: Likewise. + * include/bits/stl_set.h: Likewise. + * include/bits/stl_vector.h: Likewise. + * include/bits/vector.tcc: Likewise. + * include/std/std_bitset.h: Likewise. + * testsuite/23_containers/bitset/18604.cc: New. + * testsuite/23_containers/deque/18604.cc: Likewise. + * testsuite/23_containers/list/18604.cc: Likewise. + * testsuite/23_containers/map/18604.cc: Likewise. + * testsuite/23_containers/set/18604.cc: Likewise. + * testsuite/23_containers/vector/18604.cc: Likewise. + 2005-05-09 Mike Stump * configure: Regenerate. diff --git a/libstdc++-v3/include/bits/deque.tcc b/libstdc++-v3/include/bits/deque.tcc index 0c57bd53a11..c5440b22419 100644 --- a/libstdc++-v3/include/bits/deque.tcc +++ b/libstdc++-v3/include/bits/deque.tcc @@ -1,6 +1,6 @@ // Deque implementation (out of line) -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -203,7 +203,7 @@ namespace _GLIBCXX_STD void deque<_Tp, _Alloc> ::_M_assign_aux(_InputIterator __first, _InputIterator __last, - input_iterator_tag) + std::input_iterator_tag) { iterator __cur = begin(); for (; __first != __last && __cur != end(); ++__cur, ++__first) @@ -287,7 +287,7 @@ namespace _GLIBCXX_STD void deque<_Tp, _Alloc>:: _M_range_initialize(_InputIterator __first, _InputIterator __last, - input_iterator_tag) + std::input_iterator_tag) { this->_M_initialize_map(0); try @@ -307,7 +307,7 @@ namespace _GLIBCXX_STD void deque<_Tp, _Alloc>:: _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, - forward_iterator_tag) + std::forward_iterator_tag) { const size_type __n = std::distance(__first, __last); this->_M_initialize_map(__n); @@ -417,7 +417,7 @@ namespace _GLIBCXX_STD deque<_Tp, _Alloc>:: _M_range_insert_aux(iterator __pos, _InputIterator __first, _InputIterator __last, - input_iterator_tag) + std::input_iterator_tag) { std::copy(__first, __last, std::inserter(*this, __pos)); } template @@ -426,7 +426,7 @@ namespace _GLIBCXX_STD deque<_Tp, _Alloc>:: _M_range_insert_aux(iterator __pos, _ForwardIterator __first, _ForwardIterator __last, - forward_iterator_tag) + std::forward_iterator_tag) { const size_type __n = std::distance(__first, __last); if (__pos._M_cur == this->_M_impl._M_start._M_cur) diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 5e95415e5de..bdd21559fb9 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -106,7 +106,8 @@ namespace _GLIBCXX_STD { *_M_p ^= _M_mask; } }; - struct _Bit_iterator_base : public iterator + struct _Bit_iterator_base + : public std::iterator { _Bit_type * _M_p; unsigned int _M_offset; @@ -489,7 +490,7 @@ template template void _M_initialize_range(_InputIterator __first, _InputIterator __last, - input_iterator_tag) + std::input_iterator_tag) { this->_M_impl._M_start = iterator(); this->_M_impl._M_finish = iterator(); @@ -501,7 +502,7 @@ template template void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last, - forward_iterator_tag) + std::forward_iterator_tag) { const size_type __n = std::distance(__first, __last); _M_initialize(__n); @@ -511,7 +512,7 @@ template template void _M_insert_range(iterator __pos, _InputIterator __first, - _InputIterator __last, input_iterator_tag) + _InputIterator __last, std::input_iterator_tag) { for (; __first != __last; ++__first) { @@ -523,7 +524,7 @@ template template void _M_insert_range(iterator __position, _ForwardIterator __first, - _ForwardIterator __last, forward_iterator_tag) + _ForwardIterator __last, std::forward_iterator_tag) { if (__first != __last) { @@ -746,7 +747,7 @@ template template void _M_assign_aux(_InputIterator __first, _InputIterator __last, - input_iterator_tag) + std::input_iterator_tag) { iterator __cur = begin(); for (; __first != __last && __cur != end(); ++__cur, ++__first) @@ -760,7 +761,7 @@ template template void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, - forward_iterator_tag) + std::forward_iterator_tag) { const size_type __len = std::distance(__first, __last); if (__len < size()) diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h index 27d0304ba04..fdee3d5aedf 100644 --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -106,14 +106,14 @@ namespace _GLIBCXX_STD static size_t _S_buffer_size() { return __deque_buf_size(sizeof(_Tp)); } - typedef random_access_iterator_tag iterator_category; - typedef _Tp value_type; - typedef _Ptr pointer; - typedef _Ref reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp** _Map_pointer; - typedef _Deque_iterator _Self; + typedef std::random_access_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Ptr pointer; + typedef _Ref reference; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp** _Map_pointer; + typedef _Deque_iterator _Self; _Tp* _M_cur; _Tp* _M_first; @@ -591,7 +591,7 @@ namespace _GLIBCXX_STD * and we can use other standard algorithms as well. * @endif */ - template > + template > class deque : protected _Deque_base<_Tp, _Alloc> { // concept requirements @@ -1214,8 +1214,8 @@ namespace _GLIBCXX_STD _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { - typedef typename iterator_traits<_InputIterator>::iterator_category - _IterCategory; + typedef typename std::iterator_traits<_InputIterator>:: + iterator_category _IterCategory; _M_range_initialize(__first, __last, _IterCategory()); } @@ -1236,13 +1236,13 @@ namespace _GLIBCXX_STD template void _M_range_initialize(_InputIterator __first, _InputIterator __last, - input_iterator_tag); + std::input_iterator_tag); // called by the second initialize_dispatch above template void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, - forward_iterator_tag); + std::forward_iterator_tag); //@} /** @@ -1278,8 +1278,8 @@ namespace _GLIBCXX_STD _M_assign_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { - typedef typename iterator_traits<_InputIterator>::iterator_category - _IterCategory; + typedef typename std::iterator_traits<_InputIterator>:: + iterator_category _IterCategory; _M_assign_aux(__first, __last, _IterCategory()); } @@ -1287,13 +1287,13 @@ namespace _GLIBCXX_STD template void _M_assign_aux(_InputIterator __first, _InputIterator __last, - input_iterator_tag); + std::input_iterator_tag); // called by the second assign_dispatch above template void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, - forward_iterator_tag) + std::forward_iterator_tag) { const size_type __len = std::distance(__first, __last); if (__len > size()) @@ -1356,8 +1356,8 @@ namespace _GLIBCXX_STD _InputIterator __first, _InputIterator __last, __false_type) { - typedef typename iterator_traits<_InputIterator>::iterator_category - _IterCategory; + typedef typename std::iterator_traits<_InputIterator>:: + iterator_category _IterCategory; _M_range_insert_aux(__pos, __first, __last, _IterCategory()); } @@ -1365,13 +1365,13 @@ namespace _GLIBCXX_STD template void _M_range_insert_aux(iterator __pos, _InputIterator __first, - _InputIterator __last, input_iterator_tag); + _InputIterator __last, std::input_iterator_tag); // called by the second insert_dispatch above template void _M_range_insert_aux(iterator __pos, _ForwardIterator __first, - _ForwardIterator __last, forward_iterator_tag); + _ForwardIterator __last, std::forward_iterator_tag); // Called by insert(p,n,x), and the range insert when it turns out to be // the same thing. Can use fill functions in optimal situations, diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index b928e00515b..ce167ef80e4 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -110,14 +110,14 @@ namespace _GLIBCXX_STD template struct _List_iterator { - typedef _List_iterator<_Tp> _Self; - typedef _List_node<_Tp> _Node; + typedef _List_iterator<_Tp> _Self; + typedef _List_node<_Tp> _Node; - typedef ptrdiff_t difference_type; - typedef bidirectional_iterator_tag iterator_category; - typedef _Tp value_type; - typedef _Tp* pointer; - typedef _Tp& reference; + typedef ptrdiff_t difference_type; + typedef std::bidirectional_iterator_tag iterator_category; + typedef _Tp value_type; + typedef _Tp* pointer; + typedef _Tp& reference; _List_iterator() : _M_node() { } @@ -186,15 +186,15 @@ namespace _GLIBCXX_STD template struct _List_const_iterator { - typedef _List_const_iterator<_Tp> _Self; - typedef const _List_node<_Tp> _Node; - typedef _List_iterator<_Tp> iterator; + typedef _List_const_iterator<_Tp> _Self; + typedef const _List_node<_Tp> _Node; + typedef _List_iterator<_Tp> iterator; - typedef ptrdiff_t difference_type; - typedef bidirectional_iterator_tag iterator_category; - typedef _Tp value_type; - typedef const _Tp* pointer; - typedef const _Tp& reference; + typedef ptrdiff_t difference_type; + typedef std::bidirectional_iterator_tag iterator_category; + typedef _Tp value_type; + typedef const _Tp* pointer; + typedef const _Tp& reference; _List_const_iterator() : _M_node() { } @@ -387,7 +387,7 @@ namespace _GLIBCXX_STD * iterator's next/previous pointers refer to itself, the %list is * %empty. @endif */ - template > + template > class list : protected _List_base<_Tp, _Alloc> { // concept requirements diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index 8535ae5f268..a0834a763bc 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -1,6 +1,6 @@ // Map implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -86,8 +86,8 @@ namespace _GLIBCXX_STD * called (*_unique versus *_equal, same as the standard). * @endif */ - template , - typename _Alloc = allocator > > + template , + typename _Alloc = std::allocator > > class map { // concept requirements @@ -98,11 +98,11 @@ namespace _GLIBCXX_STD public: typedef _Key key_type; typedef _Tp mapped_type; - typedef pair value_type; + typedef std::pair value_type; typedef _Compare key_compare; class value_compare - : public binary_function + : public std::binary_function { friend class map<_Key,_Tp,_Compare,_Alloc>; protected: @@ -355,7 +355,7 @@ namespace _GLIBCXX_STD * * Insertion requires logarithmic time. */ - pair + std::pair insert(const value_type& __x) { return _M_t.insert_unique(__x); } @@ -589,7 +589,7 @@ namespace _GLIBCXX_STD * * This function probably only makes sense for multimaps. */ - pair + std::pair equal_range(const key_type& __x) { return _M_t.equal_range(__x); } @@ -608,7 +608,7 @@ namespace _GLIBCXX_STD * * This function probably only makes sense for multimaps. */ - pair + std::pair equal_range(const key_type& __x) const { return _M_t.equal_range(__x); } diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index e080f9aaba7..524b2366813 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -1,6 +1,6 @@ // Multimap implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -68,8 +68,8 @@ namespace _GLIBCXX_STD // Forward declaration of operators < and ==, needed for friend declaration. template , - typename _Alloc = allocator > > + typename _Compare = std::less<_Key>, + typename _Alloc = std::allocator > > class multimap; template @@ -114,11 +114,11 @@ namespace _GLIBCXX_STD public: typedef _Key key_type; typedef _Tp mapped_type; - typedef pair value_type; + typedef std::pair value_type; typedef _Compare key_compare; class value_compare - : public binary_function + : public std::binary_function { friend class multimap<_Key,_Tp,_Compare,_Alloc>; protected: @@ -573,7 +573,7 @@ namespace _GLIBCXX_STD * @endcode * (but is faster than making the calls separately). */ - pair + std::pair equal_range(const key_type& __x) { return _M_t.equal_range(__x); } @@ -590,7 +590,7 @@ namespace _GLIBCXX_STD * @endcode * (but is faster than making the calls separately). */ - pair + std::pair equal_range(const key_type& __x) const { return _M_t.equal_range(__x); } diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index c82dee68e4e..3f42ef4c38d 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -1,6 +1,6 @@ // Multiset implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -67,8 +67,8 @@ namespace _GLIBCXX_STD { // Forward declaration of operators < and ==, needed for friend declaration. - template , - class _Alloc = allocator<_Key> > + template , + class _Alloc = std::allocator<_Key> > class multiset; template @@ -492,11 +492,11 @@ namespace _GLIBCXX_STD * * This function probably only makes sense for multisets. */ - pair + std::pair equal_range(const key_type& __x) { return _M_t.equal_range(__x); } - pair + std::pair equal_range(const key_type& __x) const { return _M_t.equal_range(__x); } diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index bb28bddc7af..1a15d1172c8 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -1,6 +1,6 @@ // Set implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -66,8 +66,8 @@ namespace _GLIBCXX_STD { // Forward declarations of operators < and ==, needed for friend declaration. - template, - class _Alloc = allocator<_Key> > + template, + class _Alloc = std::allocator<_Key> > class set; template @@ -308,11 +308,12 @@ namespace _GLIBCXX_STD * * Insertion requires logarithmic time. */ - pair + std::pair insert(const value_type& __x) { - pair __p = _M_t.insert_unique(__x); - return pair(__p.first, __p.second); + std::pair __p = + _M_t.insert_unique(__x); + return std::pair(__p.first, __p.second); } /** @@ -502,11 +503,11 @@ namespace _GLIBCXX_STD * * This function probably only makes sense for multisets. */ - pair + std::pair equal_range(const key_type& __x) { return _M_t.equal_range(__x); } - pair + std::pair equal_range(const key_type& __x) const { return _M_t.equal_range(__x); } //@} diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 3495d9312ae..d532c2dc910 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -144,7 +144,7 @@ namespace _GLIBCXX_STD * memory and size allocation. Subscripting ( @c [] ) access is * also provided as with C-style arrays. */ - template > + template > class vector : protected _Vector_base<_Tp, _Alloc> { // Concept requirements. @@ -795,8 +795,8 @@ namespace _GLIBCXX_STD _M_initialize_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { - typedef typename iterator_traits<_InputIterator>::iterator_category - _IterCategory; + typedef typename std::iterator_traits<_InputIterator>:: + iterator_category _IterCategory; _M_range_initialize(__first, __last, _IterCategory()); } @@ -804,7 +804,7 @@ namespace _GLIBCXX_STD template void _M_range_initialize(_InputIterator __first, - _InputIterator __last, input_iterator_tag) + _InputIterator __last, std::input_iterator_tag) { for (; __first != __last; ++__first) push_back(*__first); @@ -814,7 +814,7 @@ namespace _GLIBCXX_STD template void _M_range_initialize(_ForwardIterator __first, - _ForwardIterator __last, forward_iterator_tag) + _ForwardIterator __last, std::forward_iterator_tag) { const size_type __n = std::distance(__first, __last); this->_M_impl._M_start = this->_M_allocate(__n); @@ -844,8 +844,8 @@ namespace _GLIBCXX_STD _M_assign_dispatch(_InputIterator __first, _InputIterator __last, __false_type) { - typedef typename iterator_traits<_InputIterator>::iterator_category - _IterCategory; + typedef typename std::iterator_traits<_InputIterator>:: + iterator_category _IterCategory; _M_assign_aux(__first, __last, _IterCategory()); } @@ -853,13 +853,13 @@ namespace _GLIBCXX_STD template void _M_assign_aux(_InputIterator __first, _InputIterator __last, - input_iterator_tag); + std::input_iterator_tag); // Called by the second assign_dispatch above template void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, - forward_iterator_tag); + std::forward_iterator_tag); // Called by assign(n,t), and the range assign when it turns out // to be the same thing. @@ -885,8 +885,8 @@ namespace _GLIBCXX_STD _M_insert_dispatch(iterator __pos, _InputIterator __first, _InputIterator __last, __false_type) { - typedef typename iterator_traits<_InputIterator>::iterator_category - _IterCategory; + typedef typename std::iterator_traits<_InputIterator>:: + iterator_category _IterCategory; _M_range_insert(__pos, __first, __last, _IterCategory()); } @@ -894,13 +894,13 @@ namespace _GLIBCXX_STD template void _M_range_insert(iterator __pos, _InputIterator __first, - _InputIterator __last, input_iterator_tag); + _InputIterator __last, std::input_iterator_tag); // Called by the second insert_dispatch above template void _M_range_insert(iterator __pos, _ForwardIterator __first, - _ForwardIterator __last, forward_iterator_tag); + _ForwardIterator __last, std::forward_iterator_tag); // Called by insert(p,n,x), and the range insert when it turns out to be // the same thing. diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc index 57144b073bb..f9f5e5ac8a7 100644 --- a/libstdc++-v3/include/bits/vector.tcc +++ b/libstdc++-v3/include/bits/vector.tcc @@ -1,6 +1,6 @@ // Vector implementation (out of line) -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -192,7 +192,7 @@ namespace _GLIBCXX_STD void vector<_Tp, _Alloc>:: _M_assign_aux(_InputIterator __first, _InputIterator __last, - input_iterator_tag) + std::input_iterator_tag) { iterator __cur(begin()); for (; __first != __last && __cur != end(); ++__cur, ++__first) @@ -208,7 +208,7 @@ namespace _GLIBCXX_STD void vector<_Tp, _Alloc>:: _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last, - forward_iterator_tag) + std::forward_iterator_tag) { const size_type __len = std::distance(__first, __last); @@ -392,7 +392,7 @@ namespace _GLIBCXX_STD void vector<_Tp, _Alloc>:: _M_range_insert(iterator __pos, _InputIterator __first, - _InputIterator __last, input_iterator_tag) + _InputIterator __last, std::input_iterator_tag) { for (; __first != __last; ++__first) { @@ -406,7 +406,7 @@ namespace _GLIBCXX_STD void vector<_Tp, _Alloc>:: _M_range_insert(iterator __position, _ForwardIterator __first, - _ForwardIterator __last, forward_iterator_tag) + _ForwardIterator __last, std::forward_iterator_tag) { if (__first != __last) { diff --git a/libstdc++-v3/include/std/std_bitset.h b/libstdc++-v3/include/std/std_bitset.h index dc677786a2d..76be09d821a 100644 --- a/libstdc++-v3/include/std/std_bitset.h +++ b/libstdc++-v3/include/std/std_bitset.h @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -751,7 +751,7 @@ namespace _GLIBCXX_STD */ template explicit - bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, + bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, size_t __position = 0) : _Base() { @@ -759,7 +759,7 @@ namespace _GLIBCXX_STD __throw_out_of_range(__N("bitset::bitset initial position " "not valid")); _M_copy_from_string(__s, __position, - basic_string<_CharT, _Traits, _Alloc>::npos); + std::basic_string<_CharT, _Traits, _Alloc>::npos); } /** @@ -772,7 +772,7 @@ namespace _GLIBCXX_STD * which is neither '0' nor '1'. */ template - bitset(const basic_string<_CharT, _Traits, _Alloc>& __s, + bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s, size_t __position, size_t __n) : _Base() { @@ -1014,10 +1014,10 @@ namespace _GLIBCXX_STD * an example). */ template - basic_string<_CharT, _Traits, _Alloc> + std::basic_string<_CharT, _Traits, _Alloc> to_string() const { - basic_string<_CharT, _Traits, _Alloc> __result; + std::basic_string<_CharT, _Traits, _Alloc> __result; _M_copy_to_string(__result); return __result; } @@ -1025,28 +1025,36 @@ namespace _GLIBCXX_STD // _GLIBCXX_RESOLVE_LIB_DEFECTS // 434. bitset::to_string() hard to use. template - basic_string<_CharT, _Traits, allocator<_CharT> > + std::basic_string<_CharT, _Traits, std::allocator<_CharT> > to_string() const - { return to_string<_CharT, _Traits, allocator<_CharT> >(); } + { return to_string<_CharT, _Traits, std::allocator<_CharT> >(); } template - basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > + std::basic_string<_CharT, std::char_traits<_CharT>, + std::allocator<_CharT> > to_string() const - { return to_string<_CharT, char_traits<_CharT>, allocator<_CharT> >(); } + { + return to_string<_CharT, std::char_traits<_CharT>, + std::allocator<_CharT> >(); + } - basic_string, allocator > + std::basic_string, std::allocator > to_string() const - { return to_string, allocator >(); } + { + return to_string, + std::allocator >(); + } // Helper functions for string operations. template void - _M_copy_from_string(const basic_string<_CharT, _Traits, _Alloc>& __s, + _M_copy_from_string(const std::basic_string<_CharT, + _Traits, _Alloc>& __s, size_t, size_t); template void - _M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>&) const; + _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>&) const; /// Returns the number of bits which are set. size_t @@ -1136,7 +1144,7 @@ namespace _GLIBCXX_STD template template void - bitset<_Nb>::_M_copy_from_string(const basic_string<_CharT, _Traits, + bitset<_Nb>::_M_copy_from_string(const std::basic_string<_CharT, _Traits, _Alloc>& __s, size_t __pos, size_t __n) { reset(); @@ -1159,7 +1167,7 @@ namespace _GLIBCXX_STD template template void - bitset<_Nb>::_M_copy_to_string(basic_string<_CharT, _Traits, + bitset<_Nb>::_M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>& __s) const { __s.assign(_Nb, '0'); @@ -1216,15 +1224,15 @@ namespace _GLIBCXX_STD * hold. */ template - basic_istream<_CharT, _Traits>& - operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) { typedef typename _Traits::char_type char_type; - basic_string<_CharT, _Traits> __tmp; + std::basic_string<_CharT, _Traits> __tmp; __tmp.reserve(_Nb); - ios_base::iostate __state = ios_base::goodbit; - typename basic_istream<_CharT, _Traits>::sentry __sentry(__is); + std::ios_base::iostate __state = std::ios_base::goodbit; + typename std::basic_istream<_CharT, _Traits>::sentry __sentry(__is); if (__sentry) { try @@ -1241,7 +1249,7 @@ namespace _GLIBCXX_STD typename _Traits::int_type __c1 = __buf->sbumpc(); if (_Traits::eq_int_type(__c1, __eof)) { - __state |= ios_base::eofbit; + __state |= std::ios_base::eofbit; break; } else @@ -1254,18 +1262,18 @@ namespace _GLIBCXX_STD else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) { - __state |= ios_base::failbit; + __state |= std::ios_base::failbit; break; } } } } catch(...) - { __is._M_setstate(ios_base::badbit); } + { __is._M_setstate(std::ios_base::badbit); } } if (__tmp.empty() && _Nb) - __state |= ios_base::failbit; + __state |= std::ios_base::failbit; else __x._M_copy_from_string(__tmp, static_cast(0), _Nb); if (__state) @@ -1274,10 +1282,11 @@ namespace _GLIBCXX_STD } template - basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Nb>& __x) + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const bitset<_Nb>& __x) { - basic_string<_CharT, _Traits> __tmp; + std::basic_string<_CharT, _Traits> __tmp; __x._M_copy_to_string(__tmp); return __os << __tmp; } diff --git a/libstdc++-v3/testsuite/23_containers/bitset/18604.cc b/libstdc++-v3/testsuite/23_containers/bitset/18604.cc new file mode 100644 index 00000000000..bc3287a4a0e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/bitset/18604.cc @@ -0,0 +1,41 @@ +// 2005-05-09 Paolo Carlini + +// Copyright (C) 2005 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-do compile } + +// libstdc++/18604 +struct less; +struct allocator; +struct pair; +struct binary_function; +struct iterator; +struct iterator_traits; +struct bidirectional_iterator_tag; +struct forward_iterator_tag; +struct input_iterator_tag; +struct random_access_iterator_tag; +struct ios_base; +struct basic_string; +struct basic_istream; +struct basic_ostream; +struct char_traits; + +#include diff --git a/libstdc++-v3/testsuite/23_containers/deque/18604.cc b/libstdc++-v3/testsuite/23_containers/deque/18604.cc new file mode 100644 index 00000000000..f9ff1f69890 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/18604.cc @@ -0,0 +1,41 @@ +// 2005-05-09 Paolo Carlini + +// Copyright (C) 2005 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-do compile } + +// libstdc++/18604 +struct less; +struct allocator; +struct pair; +struct binary_function; +struct iterator; +struct iterator_traits; +struct bidirectional_iterator_tag; +struct forward_iterator_tag; +struct input_iterator_tag; +struct random_access_iterator_tag; +struct ios_base; +struct basic_string; +struct basic_istream; +struct basic_ostream; +struct char_traits; + +#include diff --git a/libstdc++-v3/testsuite/23_containers/list/18604.cc b/libstdc++-v3/testsuite/23_containers/list/18604.cc new file mode 100644 index 00000000000..66519e5a92d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/18604.cc @@ -0,0 +1,41 @@ +// 2005-05-09 Paolo Carlini + +// Copyright (C) 2005 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-do compile } + +// libstdc++/18604 +struct less; +struct allocator; +struct pair; +struct binary_function; +struct iterator; +struct iterator_traits; +struct bidirectional_iterator_tag; +struct forward_iterator_tag; +struct input_iterator_tag; +struct random_access_iterator_tag; +struct ios_base; +struct basic_string; +struct basic_istream; +struct basic_ostream; +struct char_traits; + +#include diff --git a/libstdc++-v3/testsuite/23_containers/map/18604.cc b/libstdc++-v3/testsuite/23_containers/map/18604.cc new file mode 100644 index 00000000000..fb1d3bdd23b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/18604.cc @@ -0,0 +1,41 @@ +// 2005-05-09 Paolo Carlini + +// Copyright (C) 2005 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-do compile } + +// libstdc++/18604 +struct less; +struct allocator; +struct pair; +struct binary_function; +struct iterator; +struct iterator_traits; +struct bidirectional_iterator_tag; +struct forward_iterator_tag; +struct input_iterator_tag; +struct random_access_iterator_tag; +struct ios_base; +struct basic_string; +struct basic_istream; +struct basic_ostream; +struct char_traits; + +#include diff --git a/libstdc++-v3/testsuite/23_containers/set/18604.cc b/libstdc++-v3/testsuite/23_containers/set/18604.cc new file mode 100644 index 00000000000..57a96271bc1 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/18604.cc @@ -0,0 +1,42 @@ +// 2005-05-09 Paolo Carlini + +// Copyright (C) 2005 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-do compile } + +// libstdc++/18604 +struct less; +struct allocator; +struct pair; +struct binary_function; +struct iterator; +struct iterator_traits; +struct bidirectional_iterator_tag; +struct forward_iterator_tag; +struct input_iterator_tag; +struct random_access_iterator_tag; +struct ios_base; +struct basic_string; +struct basic_istream; +struct basic_ostream; +struct char_traits; + +#include + diff --git a/libstdc++-v3/testsuite/23_containers/vector/18604.cc b/libstdc++-v3/testsuite/23_containers/vector/18604.cc new file mode 100644 index 00000000000..d22ee6f7e43 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/18604.cc @@ -0,0 +1,41 @@ +// 2005-05-09 Paolo Carlini + +// Copyright (C) 2005 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-do compile } + +// libstdc++/18604 +struct less; +struct allocator; +struct pair; +struct binary_function; +struct iterator; +struct iterator_traits; +struct bidirectional_iterator_tag; +struct forward_iterator_tag; +struct input_iterator_tag; +struct random_access_iterator_tag; +struct ios_base; +struct basic_string; +struct basic_istream; +struct basic_ostream; +struct char_traits; + +#include