OSDN Git Service

2006-09-20 Paolo Carlini <pcarlini@suse.de>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Sep 2006 00:11:52 +0000 (00:11 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 21 Sep 2006 00:11:52 +0000 (00:11 +0000)
PR libstdc++/29134
* include/bits/stl_list.h (list<>::max_size): Forward to allocator'
max_size.
* include/bits/stl_vector.h (vector<>::max_size): Likewise.
* include/bits/stl_deque.h (deque<>::max_size): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::max_size): Likewise.
* include/tr1/hashtable (_Hashtable<>::max_size): Likewise.
* testsuite/23_containers/vector/capacity/29134.cc: Add.
* testsuite/23_containers/deque/capacity/29134.cc: Likewise.
* testsuite/23_containers/list/capacity/29134.cc: Likewise.
* testsuite/23_containers/set/capacity/29134.cc: Likewise.
* testsuite/23_containers/map/capacity/29134.cc: Likewise.
* testsuite/23_containers/multiset/capacity/29134.cc: Likewise.
* testsuite/23_containers/multimap/capacity/29134.cc: Likewise.
* testsuite/tr1/6_containers/unordered/capacity/29134-set.cc: Likewise.
* testsuite/tr1/6_containers/unordered/capacity/29134-map.cc: Likewise.
* testsuite/tr1/6_containers/unordered/capacity/29134-multiset.cc:
Likewise.
* testsuite/tr1/6_containers/unordered/capacity/29134-multimap.cc:
Likewise.

* include/bits/deque.tcc (deque<>::_M_new_elements_at_front,
deque<>::_M_new_elements_at_back): Check for length errors.
* testsuite/23_containers/deque/capacity/29134-2.cc: New.
* testsuite/23_containers/vector/capacity/29134-2.cc: Likewise.

* include/tr1/hashtable (_Hashtable<>::_M_get_Value_allocator): Add.
(_Hashtable<>::_M_allocate_node, _M_deallocate_node): Use it.
* testsuite/tr1/6_containers/unordered/instantiate/set.cc: Add test.
* testsuite/tr1/6_containers/unordered/instantiate/map.cc: Likewise.
* testsuite/tr1/6_containers/unordered/instantiate/multiset.cc:
Likewise.
* testsuite/tr1/6_containers/unordered/instantiate/multimap.cc:
Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117099 138bc75d-0d04-0410-961f-82ee72b054a4

24 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/deque.tcc
libstdc++-v3/include/bits/stl_deque.h
libstdc++-v3/include/bits/stl_list.h
libstdc++-v3/include/bits/stl_tree.h
libstdc++-v3/include/bits/stl_vector.h
libstdc++-v3/include/tr1/hashtable
libstdc++-v3/testsuite/23_containers/deque/capacity/29134-2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/deque/capacity/29134.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/map/capacity/29134.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/multimap/capacity/29134.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/multiset/capacity/29134.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/vector/capacity/29134-2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/vector/capacity/29134.cc [new file with mode: 0644]
libstdc++-v3/testsuite/tr1/6_containers/unordered/capacity/29134-map.cc [new file with mode: 0644]
libstdc++-v3/testsuite/tr1/6_containers/unordered/capacity/29134-multimap.cc [new file with mode: 0644]
libstdc++-v3/testsuite/tr1/6_containers/unordered/capacity/29134-multiset.cc [new file with mode: 0644]
libstdc++-v3/testsuite/tr1/6_containers/unordered/capacity/29134-set.cc [new file with mode: 0644]
libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/map.cc
libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multimap.cc
libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multiset.cc
libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/set.cc

index c4f2fe8..48059eb 100644 (file)
@@ -1,3 +1,40 @@
+2006-09-20  Paolo Carlini  <pcarlini@suse.de>
+
+       PR libstdc++/29134
+       * include/bits/stl_list.h (list<>::max_size): Forward to allocator'
+       max_size.
+       * include/bits/stl_vector.h (vector<>::max_size): Likewise.
+       * include/bits/stl_deque.h (deque<>::max_size): Likewise.
+       * include/bits/stl_tree.h (_Rb_tree<>::max_size): Likewise.
+       * include/tr1/hashtable (_Hashtable<>::max_size): Likewise.
+       * testsuite/23_containers/vector/capacity/29134.cc: Add.
+       * testsuite/23_containers/deque/capacity/29134.cc: Likewise.
+       * testsuite/23_containers/list/capacity/29134.cc: Likewise.
+       * testsuite/23_containers/set/capacity/29134.cc: Likewise.
+       * testsuite/23_containers/map/capacity/29134.cc: Likewise.
+       * testsuite/23_containers/multiset/capacity/29134.cc: Likewise.
+       * testsuite/23_containers/multimap/capacity/29134.cc: Likewise. 
+       * testsuite/tr1/6_containers/unordered/capacity/29134-set.cc: Likewise.
+       * testsuite/tr1/6_containers/unordered/capacity/29134-map.cc: Likewise.
+       * testsuite/tr1/6_containers/unordered/capacity/29134-multiset.cc:
+       Likewise.
+       * testsuite/tr1/6_containers/unordered/capacity/29134-multimap.cc:
+       Likewise.
+
+       * include/bits/deque.tcc (deque<>::_M_new_elements_at_front,
+       deque<>::_M_new_elements_at_back): Check for length errors.
+       * testsuite/23_containers/deque/capacity/29134-2.cc: New.
+       * testsuite/23_containers/vector/capacity/29134-2.cc: Likewise.
+
+       * include/tr1/hashtable (_Hashtable<>::_M_get_Value_allocator): Add.
+       (_Hashtable<>::_M_allocate_node, _M_deallocate_node): Use it.
+       * testsuite/tr1/6_containers/unordered/instantiate/set.cc: Add test.
+       * testsuite/tr1/6_containers/unordered/instantiate/map.cc: Likewise.
+       * testsuite/tr1/6_containers/unordered/instantiate/multiset.cc:
+       Likewise.
+       * testsuite/tr1/6_containers/unordered/instantiate/multimap.cc:
+       Likewise.
+
 2006-09-20  Benjamin Kosnik  <bkoz@redhat.com>
 
        * include/ext/pb_ds/detail/
index 8740101..4416b71 100644 (file)
@@ -1,6 +1,7 @@
 // Deque implementation (out of line) -*- C++ -*-
 
-// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+// 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
@@ -277,13 +278,13 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
             for (__cur_node = this->_M_impl._M_start._M_node;
                  __cur_node < this->_M_impl._M_finish._M_node;
                  ++__cur_node)
-            {
-              _ForwardIterator __mid = __first;
-              std::advance(__mid, _S_buffer_size());
-              std::__uninitialized_copy_a(__first, __mid, *__cur_node,
-                                         _M_get_Tp_allocator());
-              __first = __mid;
-            }
+             {
+               _ForwardIterator __mid = __first;
+               std::advance(__mid, _S_buffer_size());
+               std::__uninitialized_copy_a(__first, __mid, *__cur_node,
+                                           _M_get_Tp_allocator());
+               __first = __mid;
+             }
             std::__uninitialized_copy_a(__first, __last,
                                        this->_M_impl._M_finish._M_first,
                                        _M_get_Tp_allocator());
@@ -659,8 +660,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
     deque<_Tp, _Alloc>::
     _M_new_elements_at_front(size_type __new_elems)
     {
-      const size_type __new_nodes
-       = (__new_elems + _S_buffer_size() - 1) / _S_buffer_size();
+      if (this->max_size() - this->size() < __new_elems)
+       __throw_length_error(__N("deque::_M_new_elements_at_front"));
+
+      const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1)
+                                    / _S_buffer_size());
       _M_reserve_map_at_front(__new_nodes);
       size_type __i;
       try
@@ -681,8 +685,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
     deque<_Tp, _Alloc>::
     _M_new_elements_at_back(size_type __new_elems)
     {
-      const size_type __new_nodes
-       = (__new_elems + _S_buffer_size() - 1) / _S_buffer_size();
+      if (this->max_size() - this->size() < __new_elems)
+       __throw_length_error(__N("deque::_M_new_elements_at_back"));
+
+      const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1)
+                                    / _S_buffer_size());
       _M_reserve_map_at_back(__new_nodes);
       size_type __i;
       try
@@ -715,8 +722,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
                         + (__add_at_front ? __nodes_to_add : 0);
          if (__new_nstart < this->_M_impl._M_start._M_node)
            std::copy(this->_M_impl._M_start._M_node,
-                   this->_M_impl._M_finish._M_node + 1,
-                   __new_nstart);
+                     this->_M_impl._M_finish._M_node + 1,
+                     __new_nstart);
          else
            std::copy_backward(this->_M_impl._M_start._M_node,
                               this->_M_impl._M_finish._M_node + 1,
index ffa5874..03cda69 100644 (file)
@@ -870,7 +870,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
       /**  Returns the size() of the largest possible %deque.  */
       size_type
       max_size() const
-      { return size_type(-1); }
+      { return _M_get_Tp_allocator().max_size(); }
 
       /**
        *  @brief  Resizes the %deque to the specified number of elements.
@@ -1521,7 +1521,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
       }
 
       void
-      _M_reserve_map_at_front (size_type __nodes_to_add = 1)
+      _M_reserve_map_at_front(size_type __nodes_to_add = 1)
       {
        if (__nodes_to_add > size_type(this->_M_impl._M_start._M_node
                                       - this->_M_impl._M_map))
index 5ae400f..e37e5ee 100644 (file)
@@ -662,7 +662,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
       /**  Returns the size() of the largest possible %list.  */
       size_type
       max_size() const
-      { return size_type(-1); }
+      { return _M_get_Tp_allocator().max_size(); }
 
       /**
        *  @brief Resizes the %list to the specified number of elements.
index ecea171..e1efe0a 100644 (file)
@@ -650,7 +650,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
       size_type
       max_size() const
-      { return size_type(-1); }
+      { return get_allocator().max_size(); }
 
       void
       swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t);
index b4434fc..a81c597 100644 (file)
@@ -399,7 +399,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
       /**  Returns the size() of the largest possible %vector.  */
       size_type
       max_size() const
-      { return size_type(-1) / sizeof(value_type); }
+      { return _M_get_Tp_allocator().max_size(); }
 
       /**
        *  @brief  Resizes the %vector to the specified number of elements.
index 07ac6a8..f4451b9 100644 (file)
@@ -73,8 +73,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
   // _Key and _Value: arbitrary CopyConstructible types.
   
   // _Allocator: an allocator type ([lib.allocator.requirements]) whose
-  // value type is Value.
-  
+  // value type is Value.  As a conforming extension, we allow for
+  // value type != Value.
+
   // _ExtractKey: function object that takes a object of type Value
   // and returns a value of type _Key.
   
@@ -106,7 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
   // bucket count.  If not, returns make_pair(false, <anything>).
   
   // ??? Right now it is hard-wired that the number of buckets never
-  // shrinks.  Should we allow RehashPolicy to change that?
+  // shrinks.  Should we allow _RehashPolicy to change that?
   
   // __cache_hash_code: bool.  true if we store the value of the hash
   // function along with the value.  This is a time-space tradeoff.
@@ -154,8 +155,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
       typedef _Value                                      value_type;
       typedef _Key                                        key_type;
       typedef _Equal                                      key_equal;
-      // mapped_type, if present, comes from map_base.
-      // hasher, if present, comes from hash_code_base.
+      // mapped_type, if present, comes from _Map_base.
+      // hasher, if present, comes from _Hash_code_base.
       typedef typename _Allocator::difference_type        difference_type;
       typedef typename _Allocator::size_type              size_type;
       typedef typename _Allocator::reference              reference;
@@ -187,6 +188,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
       typedef typename _Allocator::template rebind<_Node*>::other
                                                         _Bucket_allocator_type;
 
+      typedef typename _Allocator::template rebind<_Value>::other
+                                                        _Value_allocator_type;
+
       _Node_allocator_type   _M_node_allocator;
       _Node**                _M_buckets;
       size_type              _M_bucket_count;
@@ -268,11 +272,15 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
 
       allocator_type
       get_allocator() const
-      { return _M_node_allocator; }
-  
+      { return allocator_type(_M_node_allocator); }
+
+      _Value_allocator_type
+      _M_get_Value_allocator() const
+      { return _Value_allocator_type(_M_node_allocator); }
+
       size_type
       max_size() const
-      { return _M_node_allocator.max_size(); }
+      { return _M_get_Value_allocator().max_size(); }
 
       // Observers
       key_equal
@@ -443,7 +451,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
       _Node* __n = _M_node_allocator.allocate(1);
       try
        {
-         get_allocator().construct(&__n->_M_v, __v);
+         _M_get_Value_allocator().construct(&__n->_M_v, __v);
          __n->_M_next = 0;
          return __n;
        }
@@ -463,7 +471,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
               _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
     _M_deallocate_node(_Node* __n)
     {
-      get_allocator().destroy(&__n->_M_v);
+      _M_get_Value_allocator().destroy(&__n->_M_v);
       _M_node_allocator.deallocate(__n, 1);
     }
 
@@ -555,10 +563,10 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
       _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,
                 _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::
       _Hashtable(_InputIterator __f, _InputIterator __l,
-               size_type __bucket_hint,
-               const _H1& __h1, const _H2& __h2, const _Hash& __h,
-               const _Equal& __eq, const _ExtractKey& __exk,
-               const allocator_type& __a)
+                size_type __bucket_hint,
+                const _H1& __h1, const _H2& __h2, const _Hash& __h,
+                const _Equal& __eq, const _ExtractKey& __exk,
+                const allocator_type& __a)
       : __detail::_Rehash_base<_RehashPolicy, _Hashtable>(),
        __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
                                  _H1, _H2, _Hash, __chc>(__exk, __eq,
@@ -599,7 +607,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
       __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,
                                _H1, _H2, _Hash, __chc>(__ht),
       __detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(__ht),
-      _M_node_allocator(__ht.get_allocator()),
+      _M_node_allocator(__ht._M_node_allocator),
       _M_bucket_count(__ht._M_bucket_count),
       _M_element_count(__ht._M_element_count),
       _M_rehash_policy(__ht._M_rehash_policy)
diff --git a/libstdc++-v3/testsuite/23_containers/deque/capacity/29134-2.cc b/libstdc++-v3/testsuite/23_containers/deque/capacity/29134-2.cc
new file mode 100644 (file)
index 0000000..bce8f91
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright (C) 2006 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 Pred 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 23.2.1.2 deque capacity [lib.deque.capacity]
+
+#include <deque>
+#include <stdexcept>
+#include <limits>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  using namespace std;
+
+  deque<int> d;
+
+  try
+    {
+      d.resize(numeric_limits<size_t>::max());
+    }
+  catch(const std::length_error&)
+    {
+      VERIFY( true );
+    }
+  catch(...)
+    {
+      VERIFY( false );
+    }
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/deque/capacity/29134.cc
new file mode 100644 (file)
index 0000000..b787f05
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2006 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 Pred 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 23.2.1.2 deque capacity [lib.deque.capacity]
+
+#include <deque>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::deque<int> d;
+
+  VERIFY( d.max_size() == d.get_allocator().max_size() );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc
new file mode 100644 (file)
index 0000000..5134665
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2006 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 Pred 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 23.2.2.2 list capacity [lib.list.capacity]
+
+#include <list>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::list<int> l;
+
+  VERIFY( l.max_size() == l.get_allocator().max_size() );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/map/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/map/capacity/29134.cc
new file mode 100644 (file)
index 0000000..6383eef
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2006 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 Pred 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 23.3.1 map capacity
+
+#include <map>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::map<int, int> m;
+
+  VERIFY( m.max_size() == m.get_allocator().max_size() );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/multimap/capacity/29134.cc
new file mode 100644 (file)
index 0000000..466a334
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2006 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 Pred 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 23.3.2 multimap capacity
+
+#include <map>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::multimap<int, int> mm;
+
+  VERIFY( mm.max_size() == mm.get_allocator().max_size() );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/multiset/capacity/29134.cc
new file mode 100644 (file)
index 0000000..ddfb165
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2006 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 Pred 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 23.3.4 multiset capacity
+
+#include <set>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::multiset<int> ms;
+
+  VERIFY( ms.max_size() == ms.get_allocator().max_size() );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/set/capacity/29134.cc
new file mode 100644 (file)
index 0000000..5165039
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2006 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 Pred 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 23.3.3 set capacity
+
+#include <set>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::set<int> s;
+
+  VERIFY( s.max_size() == s.get_allocator().max_size() );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/29134-2.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/29134-2.cc
new file mode 100644 (file)
index 0000000..79a1d24
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright (C) 2006 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 Pred 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 23.2.4.2 vector capacity [lib.vector.capacity]
+
+#include <vector>
+#include <stdexcept>
+#include <limits>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  using namespace std;
+
+  vector<int> v;
+
+  try
+    {
+      v.resize(numeric_limits<size_t>::max());
+    }
+  catch(const std::length_error&)
+    {
+      VERIFY( true );
+    }
+  catch(...)
+    {
+      VERIFY( false );
+    }
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/29134.cc
new file mode 100644 (file)
index 0000000..5a98587
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2006 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 Pred 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 23.2.4.2 vector capacity [lib.vector.capacity]
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::vector<int> v;
+
+  VERIFY( v.max_size() == v.get_allocator().max_size() );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/capacity/29134-map.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/capacity/29134-map.cc
new file mode 100644 (file)
index 0000000..459ace4
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2006 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 Pred 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 6.3.4.4  Class template unordered_map
+
+#include <tr1/unordered_map>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::tr1::unordered_map<int, int> um;
+
+  VERIFY( um.max_size() == um.get_allocator().max_size() );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/capacity/29134-multimap.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/capacity/29134-multimap.cc
new file mode 100644 (file)
index 0000000..af41fa1
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2006 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 Pred 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 6.3.4.6  Class template unordered_multimap
+
+#include <tr1/unordered_map>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::tr1::unordered_multimap<int, int> umm;
+
+  VERIFY( umm.max_size() == umm.get_allocator().max_size() );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/capacity/29134-multiset.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/capacity/29134-multiset.cc
new file mode 100644 (file)
index 0000000..923af9b
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2006 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 Pred 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 6.3.4.5  Class template unordered_multiset
+
+#include <tr1/unordered_set>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::tr1::unordered_multiset<int> ums;
+
+  VERIFY( ums.max_size() == ums.get_allocator().max_size() );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/capacity/29134-set.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/capacity/29134-set.cc
new file mode 100644 (file)
index 0000000..5822341
--- /dev/null
@@ -0,0 +1,38 @@
+// Copyright (C) 2006 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 Pred 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 6.3.4.3  Class template unordered_set
+
+#include <tr1/unordered_set>
+#include <testsuite_hooks.h>
+
+// libstdc++/29134
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+
+  std::tr1::unordered_set<int> us;
+
+  VERIFY( us.max_size() == us.get_allocator().max_size() );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
index cb1cf2f..41ce95d 100644 (file)
@@ -2,7 +2,7 @@
 
 // 2005-02-17  Matt Austern  <austern@apple.com>
 //
-// Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+// Copyright (C) 2004, 2005, 2006 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
@@ -32,3 +32,6 @@ template class unordered_map<string, float>;
 template class unordered_map<string, float,
                             hash<string>, equal_to<string>, 
                             allocator<pair<const string, float> >, true>;
+template class unordered_map<string, float,
+                            hash<string>, equal_to<string>, 
+                            allocator<char>, false>;
index 7328261..d48aef8 100644 (file)
@@ -2,7 +2,7 @@
 
 // 2005-02-17  Matt Austern  <austern@apple.com>
 //
-// Copyright (C) 2005 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006 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
@@ -32,3 +32,6 @@ template class unordered_multimap<string, float>;
 template class unordered_multimap<string, float,
                                  hash<string>, equal_to<string>, 
                                  allocator<pair<const string, float> >, true>;
+template class unordered_multimap<string, float,
+                                 hash<string>, equal_to<string>, 
+                                 allocator<char>, false>;
index e022e8b..5d1e871 100644 (file)
@@ -2,7 +2,7 @@
 
 // 2005-02-17  Matt Austern  <austern@apple.com>
 //
-// Copyright (C) 2005 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006 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
@@ -30,3 +30,5 @@ using namespace std::tr1;
 template class unordered_multiset<int>;
 template class unordered_multiset<int, hash<int>, equal_to<int>,
                                  allocator<int>, true>;
+template class unordered_multiset<int, hash<int>, equal_to<int>,
+                                 allocator<char>, false>;
index 9bb892e..ae3214f 100644 (file)
@@ -2,7 +2,7 @@
 
 // 2005-02-17  Matt Austern  <austern@apple.com>
 //
-// Copyright (C) 2005 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006 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
@@ -30,3 +30,5 @@ using namespace std::tr1;
 template class unordered_set<int>;
 template class unordered_set<int, hash<int>, equal_to<int>,
                             allocator<int>, true>;
+template class unordered_set<int, hash<int>, equal_to<int>,
+                            allocator<char>, false>;