summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog92
-rw-r--r--libstdc++-v3/include/bits/allocator.h30
-rw-r--r--libstdc++-v3/include/bits/basic_string.h11
-rw-r--r--libstdc++-v3/include/bits/deque.tcc18
-rw-r--r--libstdc++-v3/include/bits/ptr_traits.h2
-rw-r--r--libstdc++-v3/include/bits/stl_bvector.h30
-rw-r--r--libstdc++-v3/include/bits/stl_deque.h5
-rw-r--r--libstdc++-v3/include/bits/stl_tempbuf.h5
-rw-r--r--libstdc++-v3/include/bits/stl_vector.h5
-rw-r--r--libstdc++-v3/include/bits/unique_ptr.h2
-rw-r--r--libstdc++-v3/include/bits/vector.tcc62
-rw-r--r--libstdc++-v3/include/debug/deque7
-rw-r--r--libstdc++-v3/include/debug/string15
-rw-r--r--libstdc++-v3/include/debug/vector10
-rw-r--r--libstdc++-v3/include/ext/extptr_allocator.h9
-rw-r--r--libstdc++-v3/include/ext/vstring.h11
-rw-r--r--libstdc++-v3/include/std/functional50
-rw-r--r--libstdc++-v3/include/std/tuple149
-rw-r--r--libstdc++-v3/include/std/valarray4
-rw-r--r--libstdc++-v3/testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc15
-rw-r--r--libstdc++-v3/testsuite/20_util/allocator_traits/requirements/typedefs.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/cons/noexcept_move_construct.cc27
-rw-r--r--libstdc++-v3/testsuite/20_util/unique_ptr/cons/noexcept_move_construct.cc27
-rw-r--r--libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/weak_ptr/cons/noexcept_move_construct.cc27
-rw-r--r--libstdc++-v3/testsuite/21_strings/debug/shrink_to_fit.cc39
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/debug/shrink_to_fit.cc51
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/bool/capacity/shrink_to_fit.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/bool/shrink_to_fit.cc42
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/debug/shrink_to_fit.cc40
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/ext_pointer/explicit_instantiation/2.cc28
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/ext_pointer/types/2.cc63
-rw-r--r--libstdc++-v3/testsuite/26_numerics/valarray/noexcept_move_construct.cc27
-rw-r--r--libstdc++-v3/testsuite/30_threads/packaged_task/uses_allocator.cc32
-rw-r--r--libstdc++-v3/testsuite/30_threads/promise/uses_allocator.cc32
36 files changed, 815 insertions, 198 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index f96b961c2f5..42f951478e7 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,95 @@
+2011-06-20 Daniel Krugler <daniel.kruegler@googlemail.com>
+ Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/tuple (__conv_types, __one_by_one_convertible,
+ __all_convertible): Add.
+ (tuple): Use the latter.
+ (tuple<_T1>): Remove.
+ * testsuite/20_util/uses_allocator/cons_neg.cc: Adjust dg-error
+ line number.
+ * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Likewise.
+
+2011-06-14 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/bits/ptr_traits.h (pointer_traits<T*>::pointer_to): Use
+ noexcept.
+
+2011-06-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/valarray (~valarray): Use noexcept.
+ * include/bits/unique_ptr.h (~unique_ptr): Likewise.
+ * testsuite/26_numerics/valarray/noexcept_move_construct.cc: New.
+ * testsuite/20_util/shared_ptr/cons/noexcept_move_construct.cc:
+ Likewise.
+ * testsuite/20_util/unique_ptr/cons/noexcept_move_construct.cc:
+ Likewise.
+ * testsuite/20_util/weak_ptr/cons/noexcept_move_construct.cc:
+ Likewise.
+
+2011-06-14 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/functional: Use noexcept.
+ * include/bits/stl_tempbuf.h: Likewise.
+
+2011-06-12 François Dumont <francois.cppdevs@free.fr>
+ Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/allocator.h (__shrink_to_fit): Rename to
+ __shrink_to_fit_aux, fix.
+ * include/bits/stl_vector.h (_M_shrink_to_fit): Declare.
+ (shrink_to_fit): Use the latter.
+ * include/debug/vector (shrink_to_fit): Likewise.
+ * include/bits/vector.tcc (_M_shrink_to_fit): Define.
+ * include/bits/stl_deque.h (_M_shrink_to_fit): Declare.
+ (shrink_to_fit): Use the latter.
+ * include/debug/deque (shrink_to_fit): Likewise.
+ * include/bits/deque.tcc (_M_shrink_to_fit): Define.
+ * include/bits/vector.tcc (vector<bool>::_M_reallocate): Add.
+ * include/bits/stl_bvector.h (_M_shrink_to_fit): Declare.
+ (shrink_to_fit): Use the latter.
+ (reserve): Use _M_reallocate, move inline.
+ (_Bvector_base<>::_S_nword): Add, use it throughout.
+ * include/debug/string (shrink_to_fit): Redo.
+ * include/ext/vstring.h (shrink_to_fit): Optimize.
+ * include/bits/basic_string.h (shrink_to_fit): Likewise.
+ * testsuite/21_strings/debug/shrink_to_fit.cc: New.
+ * testsuite/23_containers/vector/debug/shrink_to_fit.cc: Likewise.
+ * testsuite/23_containers/vector/debug/bool/shrink_to_fit.cc:
+ Likewise.
+ * testsuite/23_containers/vector/bool/capacity/shrink_to_fit.cc:
+ Likewise.
+ * testsuite/23_containers/deque/debug/shrink_to_fit.cc: Likewise.
+
+2011-06-11 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * testsuite/tr1/6_containers/tuple/creation_functions/tie2.cc: Fix for
+ C++0x mode.
+ * testsuite/25_algorithms/sort/35588.cc: Likewise.
+ * testsuite/26_numerics/headers/complex/synopsis.cc: Likewise.
+
+2011-06-11 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/ext/extptr_allocator.h (construct, destroy): Fix for C++0x
+ mode by overloading to take allocator's pointer type.
+ * testsuite/23_containers/vector/ext_pointer/types/2.cc: New.
+ * testsuite/23_containers/vector/ext_pointer/explicit_instantiation/
+ 2.cc: New.
+
+2011-06-11 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * testsuite/20_util/allocator_traits/requirements/
+ explicit_instantiation.cc: Add another instantiation.
+
+2011-06-11 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * testsuite/20_util/allocator_traits/requirements/typedefs.cc: Check
+ for allocator_type and value_type.
+
+2011-06-11 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * testsuite/30_threads/packaged_task/uses_allocator.cc: New.
+ * testsuite/30_threads/promise/uses_allocator.cc: Likewise.
+
2011-06-10 Paolo Carlini <paolo.carlini@oracle.com>
* include/ext/throw_allocator.h: Use noexcept.
diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h
index 7067fa09bd4..680195082da 100644
--- a/libstdc++-v3/include/bits/allocator.h
+++ b/libstdc++-v3/include/bits/allocator.h
@@ -184,18 +184,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, bool
+ = __or_<is_copy_constructible<typename _Tp::value_type>,
+ is_nothrow_move_constructible<typename _Tp::value_type>>::value>
+ struct __shrink_to_fit_aux
+ { static bool _S_do_it(_Tp&) { return false; } };
+
template<typename _Tp>
- bool
- __shrink_to_fit(_Tp& __v)
+ struct __shrink_to_fit_aux<_Tp, true>
{
- __try
- {
- _Tp(__v).swap(__v);
- return true;
- }
- __catch(...)
- { return false; }
- }
+ static bool
+ _S_do_it(_Tp& __c)
+ {
+ __try
+ {
+ _Tp(__make_move_if_noexcept_iterator(__c.begin()),
+ __make_move_if_noexcept_iterator(__c.end())).swap(__c);
+ return true;
+ }
+ __catch(...)
+ { return false; }
+ }
+ };
template<typename _Alloc, typename _Tp>
class __alloctr_rebind_helper
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index 9279a38cf4c..1022ce08e5a 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -753,10 +753,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void
shrink_to_fit()
{
- __try
- { reserve(0); }
- __catch(...)
- { }
+ if (capacity() > size())
+ {
+ __try
+ { reserve(0); }
+ __catch(...)
+ { }
+ }
}
#endif
diff --git a/libstdc++-v3/include/bits/deque.tcc b/libstdc++-v3/include/bits/deque.tcc
index 389fc80d945..fab79157cdb 100644
--- a/libstdc++-v3/include/bits/deque.tcc
+++ b/libstdc++-v3/include/bits/deque.tcc
@@ -325,6 +325,24 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
}
}
+
+ template <typename _Tp, typename _Alloc>
+ bool
+ deque<_Tp, _Alloc>::
+ _M_shrink_to_fit()
+ {
+ const difference_type __front_capacity
+ = (this->_M_impl._M_start._M_cur - this->_M_impl._M_start._M_first);
+ if (__front_capacity == 0)
+ return false;
+
+ const difference_type __back_capacity
+ = (this->_M_impl._M_finish._M_last - this->_M_impl._M_finish._M_cur);
+ if (__front_capacity + __back_capacity < _S_buffer_size())
+ return false;
+
+ return std::__shrink_to_fit_aux<deque>::_S_do_it(*this);
+ }
#endif
template <typename _Tp, typename _Alloc>
diff --git a/libstdc++-v3/include/bits/ptr_traits.h b/libstdc++-v3/include/bits/ptr_traits.h
index c83beadb149..a4dae82524e 100644
--- a/libstdc++-v3/include/bits/ptr_traits.h
+++ b/libstdc++-v3/include/bits/ptr_traits.h
@@ -211,7 +211,7 @@ _GLIBCXX_HAS_NESTED_TYPE(difference_type)
* @return @c addressof(r)
*/
static pointer
- pointer_to(typename __ptrtr_not_void<element_type>::__type& __r)
+ pointer_to(typename __ptrtr_not_void<element_type>::__type& __r) noexcept
{ return std::addressof(__r); }
};
diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
index 30e7b2d9675..22443f4a4c1 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -443,8 +443,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_Bit_type*
_M_allocate(size_t __n)
- { return _M_impl.allocate((__n + int(_S_word_bit) - 1)
- / int(_S_word_bit)); }
+ { return _M_impl.allocate(_S_nword(__n)); }
void
_M_deallocate()
@@ -453,6 +452,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_M_impl.deallocate(_M_impl._M_start._M_p,
_M_impl._M_end_of_storage - _M_impl._M_start._M_p);
}
+
+ static size_t
+ _S_nword(size_t __n)
+ { return (__n + int(_S_word_bit) - 1) / int(_S_word_bit); }
};
_GLIBCXX_END_NAMESPACE_CONTAINER
@@ -511,6 +514,7 @@ template<typename _Alloc>
protected:
using _Base::_M_allocate;
using _Base::_M_deallocate;
+ using _Base::_S_nword;
using _Base::_M_get_Bit_allocator;
public:
@@ -724,7 +728,13 @@ template<typename _Alloc>
{ _M_range_check(__n); return (*this)[__n]; }
void
- reserve(size_type __n);
+ reserve(size_type __n)
+ {
+ if (__n > max_size())
+ __throw_length_error(__N("vector::reserve"));
+ if (capacity() < __n)
+ _M_reallocate(__n);
+ }
reference
front()
@@ -844,7 +854,7 @@ template<typename _Alloc>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
void
shrink_to_fit()
- { std::__shrink_to_fit(*this); }
+ { _M_shrink_to_fit(); }
#endif
void
@@ -875,13 +885,19 @@ template<typename _Alloc>
_M_initialize(size_type __n)
{
_Bit_type* __q = this->_M_allocate(__n);
- this->_M_impl._M_end_of_storage = (__q
- + ((__n + int(_S_word_bit) - 1)
- / int(_S_word_bit)));
+ this->_M_impl._M_end_of_storage = __q + _S_nword(__n);
this->_M_impl._M_start = iterator(__q, 0);
this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n);
}
+ void
+ _M_reallocate(size_type __n);
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ bool
+ _M_shrink_to_fit();
+#endif
+
// Check whether it's an integral type. If so, it's not an iterator.
// _GLIBCXX_RESOLVE_LIB_DEFECTS
diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index fab63f130c8..6d7a18ca343 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -1196,7 +1196,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/** A non-binding request to reduce memory use. */
void
shrink_to_fit()
- { std::__shrink_to_fit(*this); }
+ { _M_shrink_to_fit(); }
#endif
/**
@@ -1847,6 +1847,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// Called by resize(sz).
void
_M_default_append(size_type __n);
+
+ bool
+ _M_shrink_to_fit();
#endif
//@{
diff --git a/libstdc++-v3/include/bits/stl_tempbuf.h b/libstdc++-v3/include/bits/stl_tempbuf.h
index a99dac93095..c4b0ddd5715 100644
--- a/libstdc++-v3/include/bits/stl_tempbuf.h
+++ b/libstdc++-v3/include/bits/stl_tempbuf.h
@@ -1,6 +1,7 @@
// Temporary buffer implementation -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+// 2010, 2011
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -83,7 +84,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template<typename _Tp>
pair<_Tp*, ptrdiff_t>
- get_temporary_buffer(ptrdiff_t __len)
+ get_temporary_buffer(ptrdiff_t __len) _GLIBCXX_NOEXCEPT
{
const ptrdiff_t __max =
__gnu_cxx::__numeric_traits<ptrdiff_t>::__max / sizeof(_Tp);
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h
index 4f617861e8f..929bcbe7ba1 100644
--- a/libstdc++-v3/include/bits/stl_vector.h
+++ b/libstdc++-v3/include/bits/stl_vector.h
@@ -646,7 +646,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/** A non-binding request to reduce capacity() to size(). */
void
shrink_to_fit()
- { std::__shrink_to_fit(*this); }
+ { _M_shrink_to_fit(); }
#endif
/**
@@ -1229,6 +1229,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// Called by resize(n).
void
_M_default_append(size_type __n);
+
+ bool
+ _M_shrink_to_fit();
#endif
// Called by insert(p,x)
diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h
index ec9c3c0b5c3..a6f457ee59e 100644
--- a/libstdc++-v3/include/bits/unique_ptr.h
+++ b/libstdc++-v3/include/bits/unique_ptr.h
@@ -166,7 +166,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
// Destructor.
- ~unique_ptr() { reset(); }
+ ~unique_ptr() noexcept { reset(); }
// Assignment.
unique_ptr&
diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc
index 5b6a8d791ae..fd576dbd2df 100644
--- a/libstdc++-v3/include/bits/vector.tcc
+++ b/libstdc++-v3/include/bits/vector.tcc
@@ -509,6 +509,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
}
}
+
+ template<typename _Tp, typename _Alloc>
+ bool
+ vector<_Tp, _Alloc>::
+ _M_shrink_to_fit()
+ {
+ if (capacity() == size())
+ return false;
+ return std::__shrink_to_fit_aux<vector>::_S_do_it(*this);
+ }
#endif
template<typename _Tp, typename _Alloc>
@@ -609,24 +619,17 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// vector<bool>
-
template<typename _Alloc>
void
vector<bool, _Alloc>::
- reserve(size_type __n)
+ _M_reallocate(size_type __n)
{
- if (__n > this->max_size())
- __throw_length_error(__N("vector::reserve"));
- if (this->capacity() < __n)
- {
- _Bit_type* __q = this->_M_allocate(__n);
- this->_M_impl._M_finish = _M_copy_aligned(begin(), end(),
- iterator(__q, 0));
- this->_M_deallocate();
- this->_M_impl._M_start = iterator(__q, 0);
- this->_M_impl._M_end_of_storage = (__q + (__n + int(_S_word_bit) - 1)
- / int(_S_word_bit));
- }
+ _Bit_type* __q = this->_M_allocate(__n);
+ this->_M_impl._M_finish = _M_copy_aligned(begin(), end(),
+ iterator(__q, 0));
+ this->_M_deallocate();
+ this->_M_impl._M_start = iterator(__q, 0);
+ this->_M_impl._M_end_of_storage = __q + _S_nword(__n);
}
template<typename _Alloc>
@@ -654,9 +657,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
this->_M_impl._M_finish = std::copy(__position, end(),
__i + difference_type(__n));
this->_M_deallocate();
- this->_M_impl._M_end_of_storage = (__q + ((__len
- + int(_S_word_bit) - 1)
- / int(_S_word_bit)));
+ this->_M_impl._M_end_of_storage = __q + _S_nword(__len);
this->_M_impl._M_start = iterator(__q, 0);
}
}
@@ -689,10 +690,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
__i = std::copy(__first, __last, __i);
this->_M_impl._M_finish = std::copy(__position, end(), __i);
this->_M_deallocate();
- this->_M_impl._M_end_of_storage = (__q
- + ((__len
- + int(_S_word_bit) - 1)
- / int(_S_word_bit)));
+ this->_M_impl._M_end_of_storage = __q + _S_nword(__len);
this->_M_impl._M_start = iterator(__q, 0);
}
}
@@ -720,13 +718,29 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
*__i++ = __x;
this->_M_impl._M_finish = std::copy(__position, end(), __i);
this->_M_deallocate();
- this->_M_impl._M_end_of_storage = (__q + ((__len
- + int(_S_word_bit) - 1)
- / int(_S_word_bit)));
+ this->_M_impl._M_end_of_storage = __q + _S_nword(__len);
this->_M_impl._M_start = iterator(__q, 0);
}
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Alloc>
+ bool
+ vector<bool, _Alloc>::
+ _M_shrink_to_fit()
+ {
+ if (capacity() - size() < int(_S_word_bit))
+ return false;
+ __try
+ {
+ _M_reallocate(size());
+ return true;
+ }
+ __catch(...)
+ { return false; }
+ }
+#endif
+
_GLIBCXX_END_NAMESPACE_CONTAINER
} // namespace std
diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque
index 749fc2e6cab..5b6bdeb544a 100644
--- a/libstdc++-v3/include/debug/deque
+++ b/libstdc++-v3/include/debug/deque
@@ -277,7 +277,12 @@ namespace __debug
#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- using _Base::shrink_to_fit;
+ void
+ shrink_to_fit()
+ {
+ if (_Base::_M_shrink_to_fit())
+ this->_M_invalidate_all();
+ }
#endif
using _Base::empty;
diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string
index b6d2b4b34ea..9e0ad61bdef 100644
--- a/libstdc++-v3/include/debug/string
+++ b/libstdc++-v3/include/debug/string
@@ -237,7 +237,20 @@ namespace __gnu_debug
{ this->resize(__n, _CharT()); }
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- using _Base::shrink_to_fit;
+ void
+ shrink_to_fit()
+ {
+ if (capacity() > size())
+ {
+ __try
+ {
+ reserve(0);
+ this->_M_invalidate_all();
+ }
+ __catch(...)
+ { }
+ }
+ }
#endif
using _Base::capacity;
diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector
index 6072515dac3..1b80974d38c 100644
--- a/libstdc++-v3/include/debug/vector
+++ b/libstdc++-v3/include/debug/vector
@@ -280,7 +280,15 @@ namespace __debug
#endif
#ifdef __GXX_EXPERIMENTAL_CXX0X__
- using _Base::shrink_to_fit;
+ void
+ shrink_to_fit()
+ {
+ if (_Base::_M_shrink_to_fit())
+ {
+ _M_guaranteed_capacity = _Base::capacity();
+ this->_M_invalidate_all();
+ }
+ }
#endif
size_type
diff --git a/libstdc++-v3/include/ext/extptr_allocator.h b/libstdc++-v3/include/ext/extptr_allocator.h
index 96aea72cc88..21b1282dbc1 100644
--- a/libstdc++-v3/include/ext/extptr_allocator.h
+++ b/libstdc++-v3/include/ext/extptr_allocator.h
@@ -107,10 +107,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
construct(_Up* __p, _Args&&... __args)
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
+ template<typename... _Args>
+ void
+ construct(pointer __p, _Args&&... __args)
+ { construct(__p.get(), std::forward<_Args>(__args)...); }
+
template<typename _Up>
void
destroy(_Up* __p)
{ __p->~_Up(); }
+
+ void destroy(pointer __p)
+ { destroy(__p.get()); }
+
#else
void construct(pointer __p, const _Tp& __val)
diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h
index a84336861a7..b0b3e2efa53 100644
--- a/libstdc++-v3/include/ext/vstring.h
+++ b/libstdc++-v3/include/ext/vstring.h
@@ -465,10 +465,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void
shrink_to_fit()
{
- __try
- { this->reserve(0); }
- __catch(...)
- { }
+ if (capacity() > size())
+ {
+ __try
+ { this->reserve(0); }
+ __catch(...)
+ { }
+ }
}
#endif
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index 0126510ce24..85df22017f6 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -437,28 +437,28 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
public:
typedef _Tp type;
- reference_wrapper(_Tp& __indata)
+ reference_wrapper(_Tp& __indata) noexcept
: _M_data(std::__addressof(__indata))
{ }
reference_wrapper(_Tp&&) = delete;
- reference_wrapper(const reference_wrapper<_Tp>& __inref):
- _M_data(__inref._M_data)
+ reference_wrapper(const reference_wrapper<_Tp>& __inref) noexcept
+ : _M_data(__inref._M_data)
{ }
reference_wrapper&
- operator=(const reference_wrapper<_Tp>& __inref)
+ operator=(const reference_wrapper<_Tp>& __inref) noexcept
{
_M_data = __inref._M_data;
return *this;
}
- operator _Tp&() const
+ operator _Tp&() const noexcept
{ return this->get(); }
_Tp&
- get() const
+ get() const noexcept
{ return *_M_data; }
template<typename... _Args>
@@ -473,13 +473,13 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
/// Denotes a reference should be taken to a variable.
template<typename _Tp>
inline reference_wrapper<_Tp>
- ref(_Tp& __t)
+ ref(_Tp& __t) noexcept
{ return reference_wrapper<_Tp>(__t); }
/// Denotes a const reference should be taken to a variable.
template<typename _Tp>
inline reference_wrapper<const _Tp>
- cref(const _Tp& __t)
+ cref(const _Tp& __t) noexcept
{ return reference_wrapper<const _Tp>(__t); }
template<typename _Tp>
@@ -491,13 +491,13 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
/// Partial specialization.
template<typename _Tp>
inline reference_wrapper<_Tp>
- ref(reference_wrapper<_Tp> __t)
+ ref(reference_wrapper<_Tp> __t) noexcept
{ return ref(__t.get()); }
/// Partial specialization.
template<typename _Tp>
inline reference_wrapper<const _Tp>
- cref(reference_wrapper<_Tp> __t)
+ cref(reference_wrapper<_Tp> __t) noexcept
{ return cref(__t.get()); }
// @} group functors
@@ -1913,13 +1913,15 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
* @brief Default construct creates an empty function call wrapper.
* @post @c !(bool)*this
*/
- function() : _Function_base() { }
+ function() noexcept
+ : _Function_base() { }
/**
* @brief Creates an empty function call wrapper.
* @post @c !(bool)*this
*/
- function(nullptr_t) : _Function_base() { }
+ function(nullptr_t) noexcept
+ : _Function_base() { }
/**
* @brief %Function copy constructor.
@@ -2050,7 +2052,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
/// @overload
template<typename _Functor>
typename enable_if<!is_integral<_Functor>::value, function&>::type
- operator=(reference_wrapper<_Functor> __f)
+ operator=(reference_wrapper<_Functor> __f) noexcept
{
function(__f).swap(*this);
return *this;
@@ -2093,7 +2095,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
*
* This function will not throw an %exception.
*/
- explicit operator bool() const
+ explicit operator bool() const noexcept
{ return !_M_empty(); }
// [3.7.2.4] function invocation
@@ -2119,7 +2121,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
*
* This function will not throw an %exception.
*/
- const type_info& target_type() const;
+ const type_info& target_type() const noexcept;
/**
* @brief Access the stored target function object.
@@ -2130,10 +2132,10 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
*
* This function will not throw an %exception.
*/
- template<typename _Functor> _Functor* target();
+ template<typename _Functor> _Functor* target() noexcept;
/// @overload
- template<typename _Functor> const _Functor* target() const;
+ template<typename _Functor> const _Functor* target() const noexcept;
#endif
private:
@@ -2187,7 +2189,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
template<typename _Res, typename... _ArgTypes>
const type_info&
function<_Res(_ArgTypes...)>::
- target_type() const
+ target_type() const noexcept
{
if (_M_manager)
{
@@ -2203,7 +2205,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
template<typename _Functor>
_Functor*
function<_Res(_ArgTypes...)>::
- target()
+ target() noexcept
{
if (typeid(_Functor) == target_type() && _M_manager)
{
@@ -2222,7 +2224,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
template<typename _Functor>
const _Functor*
function<_Res(_ArgTypes...)>::
- target() const
+ target() const noexcept
{
if (typeid(_Functor) == target_type() && _M_manager)
{
@@ -2246,13 +2248,13 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
*/
template<typename _Res, typename... _Args>
inline bool
- operator==(const function<_Res(_Args...)>& __f, nullptr_t)
+ operator==(const function<_Res(_Args...)>& __f, nullptr_t) noexcept
{ return !static_cast<bool>(__f); }
/// @overload
template<typename _Res, typename... _Args>
inline bool
- operator==(nullptr_t, const function<_Res(_Args...)>& __f)
+ operator==(nullptr_t, const function<_Res(_Args...)>& __f) noexcept
{ return !static_cast<bool>(__f); }
/**
@@ -2264,13 +2266,13 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
*/
template<typename _Res, typename... _Args>
inline bool
- operator!=(const function<_Res(_Args...)>& __f, nullptr_t)
+ operator!=(const function<_Res(_Args...)>& __f, nullptr_t) noexcept
{ return static_cast<bool>(__f); }
/// @overload
template<typename _Res, typename... _Args>
inline bool
- operator!=(nullptr_t, const function<_Res(_Args...)>& __f)
+ operator!=(nullptr_t, const function<_Res(_Args...)>& __f) noexcept
{ return static_cast<bool>(__f); }
// [20.7.15.2.7] specialized algorithms
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 10272ccb1b2..d058c676be6 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -69,6 +69,35 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __add_r_ref<_Tp&>
{ typedef _Tp& type; };
+ // To work around c++/49225 aka c++/48322.
+ template<typename...>
+ struct __conv_types { };
+
+ template<typename _Tuple1, typename _Tuple2>
+ struct __one_by_one_convertible
+ : public false_type { };
+
+ template<typename _Tp, typename _Up>
+ struct __one_by_one_convertible<__conv_types<_Tp>, __conv_types<_Up>>
+ : public is_convertible<_Tp, _Up>::type { };
+
+ template<typename _T1, typename... _TR, typename _U1, typename... _UR>
+ struct __one_by_one_convertible<__conv_types<_T1, _TR...>,
+ __conv_types<_U1, _UR...>>
+ : public __and_<is_convertible<_T1, _U1>,
+ __one_by_one_convertible<__conv_types<_TR...>,
+ __conv_types<_UR...>>>::type
+ { };
+
+ template<typename _Tuple1, typename _Tuple2>
+ struct __all_convertible;
+
+ template<typename... _TTypes, typename... _UTypes>
+ struct __all_convertible<__conv_types<_TTypes...>,
+ __conv_types<_UTypes...>>
+ : public __one_by_one_convertible<__conv_types<_TTypes...>,
+ __conv_types<_UTypes...>>::type { };
+
template<std::size_t _Idx, typename _Head, bool _IsEmpty>
struct _Head_base;
@@ -359,8 +388,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename... _UElements, typename = typename
enable_if<__and_<integral_constant<bool, sizeof...(_UElements)
== sizeof...(_Elements)>,
- __and_<is_convertible<_UElements,
- _Elements>...>>::value>::type>
+ __all_convertible<__conv_types<_UElements...>,
+ __conv_types<_Elements...>>
+ >::value>::type>
explicit
tuple(_UElements&&... __elements)
: _Inherited(std::forward<_UElements>(__elements)...) { }
@@ -371,8 +401,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename... _UElements, typename = typename
enable_if<__and_<integral_constant<bool, sizeof...(_UElements)
== sizeof...(_Elements)>,
- __and_<is_convertible<const _UElements&,
- _Elements>...>>::value>::type>
+ __all_convertible<__conv_types<const _UElements&...>,
+ __conv_types<_Elements...>>
+ >::value>::type>
tuple(const tuple<_UElements...>& __in)
: _Inherited(static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
{ }
@@ -380,8 +411,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename... _UElements, typename = typename
enable_if<__and_<integral_constant<bool, sizeof...(_UElements)
== sizeof...(_Elements)>,
- __and_<is_convertible<_UElements,
- _Elements>...>>::value>::type>
+ __all_convertible<__conv_types<_UElements...>,
+ __conv_types<_Elements...>>
+ >::value>::type>
tuple(tuple<_UElements...>&& __in)
: _Inherited(static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) { }
@@ -628,111 +660,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ _Inherited::_M_swap(__in); }
};
- /// tuple (1-element).
- // TODO: Should be simply removed when c++/49225 is fixed, worst case
- // together with a different way to constrain the constructors
- // of the primary template.
- template<typename _T1>
- class tuple<_T1> : public _Tuple_impl<0, _T1>
- {
- typedef _Tuple_impl<0, _T1> _Inherited;
-
- public:
- constexpr tuple()
- : _Inherited() { }
-
- explicit
- constexpr tuple(const _T1& __a1)
- : _Inherited(__a1) { }
-
- template<typename _U1, typename = typename
- enable_if<is_convertible<_U1, _T1>::value>::type>
- explicit
- tuple(_U1&& __a1)
- : _Inherited(std::forward<_U1>(__a1)) { }
-
- constexpr tuple(const tuple&) = default;
- tuple(tuple&&) = default;
-
- template<typename _U1, typename = typename
- enable_if<is_convertible<const _U1&, _T1>::value>::type>
- tuple(const tuple<_U1>& __in)
- : _Inherited(static_cast<const _Tuple_impl<0, _U1>&>(__in)) { }
-
- template<typename _U1, typename = typename
- enable_if<is_convertible<_U1, _T1>::value>::type>
- tuple(tuple<_U1>&& __in)
- : _Inherited(static_cast<_Tuple_impl<0, _U1>&&>(__in)) { }
-
- // allocator-extended constructors
-
- template<typename _Alloc>
- tuple(allocator_arg_t __tag, const _Alloc& __a)
- : _Inherited(__tag, __a) { }
-
- template<typename _Alloc>
- tuple(allocator_arg_t __tag, const _Alloc& __a, const _T1& __a1)
- : _Inherited(__tag, __a, __a1) { }
-
- // TODO: constrain for is_uses_allocator_constructible<_T1, _U1&&, _Alloc>
- template<typename _Alloc, typename _U1>
- tuple(allocator_arg_t __tag, const _Alloc& __a, _U1&& __a1)
- : _Inherited(__tag, __a, std::forward<_U1>(__a1)) { }
-
- template<typename _Alloc>
- tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple& __in)
- : _Inherited(__tag, __a, static_cast<const _Inherited&>(__in)) { }
-
- template<typename _Alloc>
- tuple(allocator_arg_t __tag, const _Alloc& __a, tuple&& __in)
- : _Inherited(__tag, __a, static_cast<_Inherited&&>(__in)) { }
-
- template<typename _Alloc, typename _U1>
- tuple(allocator_arg_t __tag, const _Alloc& __a, const tuple<_U1>& __in)
- : _Inherited(__tag, __a, static_cast<const _Tuple_impl<0, _U1>&>(__in))
- { }
-
- template<typename _Alloc, typename _U1>
- tuple(allocator_arg_t __tag, const _Alloc& __a, tuple<_U1>&& __in)
- : _Inherited(__tag, __a, static_cast<_Tuple_impl<0, _U1>&&>(__in)) { }
-
- tuple&
- operator=(const tuple& __in)
- {
- static_cast<_Inherited&>(*this) = __in;
- return *this;
- }
-
- tuple&
- operator=(tuple&& __in)
- noexcept(is_nothrow_move_assignable<_Inherited>::value)
- {
- static_cast<_Inherited&>(*this) = std::move(__in);
- return *this;
- }
-
- template<typename _U1>
- tuple&
- operator=(const tuple<_U1>& __in)
- {
- static_cast<_Inherited&>(*this) = __in;
- return *this;
- }
-
- template<typename _U1>
- tuple&
- operator=(tuple<_U1>&& __in)
- {
- static_cast<_Inherited&>(*this) = std::move(__in);
- return *this;
- }
-
- void
- swap(tuple& __in)
- noexcept(noexcept(__in._M_swap(__in)))
- { _Inherited::_M_swap(__in); }
- };
-
/// Gives the type of the ith element of a given tuple type.
template<std::size_t __i, typename _Tp>
diff --git a/libstdc++-v3/include/std/valarray b/libstdc++-v3/include/std/valarray
index de6886858c0..e66333e9af2 100644
--- a/libstdc++-v3/include/std/valarray
+++ b/libstdc++-v3/include/std/valarray
@@ -165,7 +165,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<class _Dom>
valarray(const _Expr<_Dom, _Tp>& __e);
- ~valarray();
+ ~valarray() _GLIBCXX_NOEXCEPT;
// _lib.valarray.assign_ assignment:
/**
@@ -697,7 +697,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp>
inline
- valarray<_Tp>::~valarray()
+ valarray<_Tp>::~valarray() _GLIBCXX_NOEXCEPT
{
std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
std::__valarray_release_memory(_M_data);
diff --git a/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc
index 13d3135cb14..f7346966790 100644
--- a/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc
+++ b/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/explicit_instantiation.cc
@@ -22,8 +22,21 @@
#include <memory>
+typedef short test_type;
+
+template<typename T>
+ struct minimal_allocator
+ {
+ typedef T value_type;
+ minimal_allocator();
+ template <typename U>
+ minimal_allocator(const minimal_allocator<U>&);
+ T* allocate(std::size_t);
+ void deallocate(T*, std::size_t);
+ };
+
namespace std
{
- typedef short test_type;
template struct allocator_traits<std::allocator<test_type>>;
+ template struct allocator_traits<minimal_allocator<test_type>>;
}
diff --git a/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/typedefs.cc
index 346824ffc2b..89f57f44792 100644
--- a/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/20_util/allocator_traits/requirements/typedefs.cc
@@ -29,6 +29,8 @@ void test01()
{
// Check for required typedefs
typedef std::allocator_traits<T> test_type;
+ typedef typename test_type::allocator_type allocator_type;
+ typedef typename test_type::value_type value_type;
typedef typename test_type::pointer pointer;
typedef typename test_type::const_pointer const_pointer;
typedef typename test_type::void_pointer void_pointer;
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/noexcept_move_construct.cc
new file mode 100644
index 00000000000..640a54bafdb
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/noexcept_move_construct.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2011-06-14 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2011 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <memory>
+
+typedef std::shared_ptr<int> sptype;
+
+static_assert(std::is_nothrow_move_constructible<sptype>::value, "Error");
diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/noexcept_move_construct.cc
new file mode 100644
index 00000000000..c5de14f52f4
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/unique_ptr/cons/noexcept_move_construct.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2011-06-14 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2011 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <memory>
+
+typedef std::unique_ptr<int> uptype;
+
+static_assert(std::is_nothrow_move_constructible<uptype>::value, "Error");
diff --git a/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
index 73a0d0f7029..ad998356c83 100644
--- a/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/uses_allocator/cons_neg.cc
@@ -44,4 +44,4 @@ void test01()
tuple<Type> t(allocator_arg, a, 1);
}
-// { dg-error "no matching function" "" { target *-*-* } 112 }
+// { dg-error "no matching function" "" { target *-*-* } 141 }
diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
index ace80cf79c0..df18712f73b 100644
--- a/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
@@ -51,7 +51,7 @@ main()
// { dg-warning "note" "" { target *-*-* } 485 }
// { dg-warning "note" "" { target *-*-* } 479 }
// { dg-warning "note" "" { target *-*-* } 469 }
-// { dg-warning "note" "" { target *-*-* } 887 }
+// { dg-warning "note" "" { target *-*-* } 814 }
// { dg-warning "note" "" { target *-*-* } 1056 }
// { dg-warning "note" "" { target *-*-* } 1050 }
// { dg-warning "note" "" { target *-*-* } 342 }
diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/cons/noexcept_move_construct.cc
new file mode 100644
index 00000000000..4e9a90df63d
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/weak_ptr/cons/noexcept_move_construct.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2011-06-14 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2011 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <memory>
+
+typedef std::weak_ptr<int> wptype;
+
+static_assert(std::is_nothrow_move_constructible<wptype>::value, "Error");
diff --git a/libstdc++-v3/testsuite/21_strings/debug/shrink_to_fit.cc b/libstdc++-v3/testsuite/21_strings/debug/shrink_to_fit.cc
new file mode 100644
index 00000000000..e2c85be268c
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/debug/shrink_to_fit.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2011 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+
+#include <debug/string>
+
+void test01()
+{
+ using __gnu_debug::string;
+ string s;
+ s.reserve(2);
+ s.push_back('a');
+ string::iterator it = s.begin();
+ s.shrink_to_fit();
+ // Following line should assert
+ *it = 'z';
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/debug/shrink_to_fit.cc b/libstdc++-v3/testsuite/23_containers/deque/debug/shrink_to_fit.cc
new file mode 100644
index 00000000000..4cce4bd3739
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/debug/shrink_to_fit.cc
@@ -0,0 +1,51 @@
+// Copyright (C) 2011 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+
+#include <deque>
+
+void test01()
+{
+ using std::deque;
+ deque<int> d;
+ // Lets generate a hole at the begining of the deque:
+ d.push_back(0);
+ d.push_back(1);
+ d.pop_front();
+ deque<int>::iterator it;
+ do
+ {
+ d.push_back(2);
+ it = d.begin();
+ auto old_abegin = &*d.begin();
+ d.shrink_to_fit();
+ if (&*d.begin() != old_abegin)
+ break;
+ }
+ while (true);
+ // Following line should assert
+ *it = 2;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/shrink_to_fit.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/shrink_to_fit.cc
new file mode 100644
index 00000000000..c3ae90e981a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/shrink_to_fit.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <vector>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<bool> vb(__CHAR_BIT__ * sizeof(unsigned long) + 1);
+ vb.pop_back();
+
+ auto old_capacity = vb.capacity();
+ vb.shrink_to_fit();
+ VERIFY( vb.capacity() < old_capacity );
+ VERIFY( vb.size() == vb.capacity() );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/bool/shrink_to_fit.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/bool/shrink_to_fit.cc
new file mode 100644
index 00000000000..8206e0e567b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/bool/shrink_to_fit.cc
@@ -0,0 +1,42 @@
+// Copyright (C) 2011 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+
+#include <vector>
+
+void test01()
+{
+ using std::vector;
+
+ vector<bool> vb(__CHAR_BIT__ * sizeof(unsigned long) + 1);
+ vb.pop_back();
+
+ vector<bool>::iterator it = vb.begin();
+ vb.shrink_to_fit();
+
+ // Following line should assert
+ *it = true;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/shrink_to_fit.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/shrink_to_fit.cc
new file mode 100644
index 00000000000..969c79a283e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/shrink_to_fit.cc
@@ -0,0 +1,40 @@
+// Copyright (C) 2011 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+// { dg-require-debug-mode "" }
+// { dg-options "-std=gnu++0x" }
+// { dg-do run { xfail *-*-* } }
+
+#include <vector>
+
+void test01()
+{
+ using std::vector;
+ vector<int> v;
+ v.reserve(2);
+ v.push_back(0);
+ vector<int>::iterator it = v.begin();
+ v.shrink_to_fit();
+ // Following line should assert
+ *it = 1;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/explicit_instantiation/2.cc
new file mode 100644
index 00000000000..974f2c4bb5c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/explicit_instantiation/2.cc
@@ -0,0 +1,28 @@
+// Test for Container using non-standard pointer types.
+
+// Copyright (C) 2011
+// 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <vector>
+#include <ext/extptr_allocator.h>
+
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+template class std::vector<int, __gnu_cxx::_ExtPtr_allocator<int> >;
diff --git a/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/types/2.cc b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/types/2.cc
new file mode 100644
index 00000000000..929e7d57cde
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/ext_pointer/types/2.cc
@@ -0,0 +1,63 @@
+// Test for Container using non-standard pointer types.
+
+// Copyright (C) 2011
+// 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// { dg-options "-std=gnu++0x" }
+
+// This is a copy of vector/types/1.cc with altered allocator.
+// The operator+()s in this test initially failed the test -
+// they stress the accurate recognition, by the compiler,
+// of _Pointer_adapter's own pointer arithmetic functions,
+// which have to match perfectly on the int type to get
+// chosen by the compiler when it sees: _Pointer_adapter<T> + int, etc.
+
+#include <vector>
+#include <ext/extptr_allocator.h>
+
+namespace N
+{
+ struct X { };
+
+ template<typename T>
+ X operator+(T, std::size_t)
+ { return X(); }
+
+ template<typename T>
+ X operator-(T, T)
+ { return X(); }
+}
+
+int main()
+{
+ std::vector<N::X, __gnu_cxx::_ExtPtr_allocator<N::X> > v(5);
+ const std::vector<N::X, __gnu_cxx::_ExtPtr_allocator<N::X> > w(1);
+
+ v[0];
+ w[0];
+ v.size();
+ v.capacity();
+ v.resize(1);
+ v.insert(v.begin(), N::X());
+ v.insert(v.begin(), 1, N::X());
+ v.insert(v.begin(), w.begin(), w.end());
+ v = w;
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/noexcept_move_construct.cc b/libstdc++-v3/testsuite/26_numerics/valarray/noexcept_move_construct.cc
new file mode 100644
index 00000000000..3d7fdc382e6
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/valarray/noexcept_move_construct.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2011-06-14 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2011 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <valarray>
+
+typedef std::valarray<int> vtype;
+
+static_assert(std::is_nothrow_move_constructible<vtype>::value, "Error");
diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/uses_allocator.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/uses_allocator.cc
new file mode 100644
index 00000000000..f6fb2aef9f9
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/packaged_task/uses_allocator.cc
@@ -0,0 +1,32 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2011 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <future>
+#include <memory>
+
+using std::uses_allocator;
+using std::allocator;
+using std::packaged_task;
+static_assert( uses_allocator<packaged_task<int()>, allocator<int>>::value,
+ "packaged_task supports uses-allocator construction" );
diff --git a/libstdc++-v3/testsuite/30_threads/promise/uses_allocator.cc b/libstdc++-v3/testsuite/30_threads/promise/uses_allocator.cc
new file mode 100644
index 00000000000..385058d7246
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/promise/uses_allocator.cc
@@ -0,0 +1,32 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2011 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <future>
+#include <memory>
+
+using std::uses_allocator;
+using std::allocator;
+using std::promise;
+static_assert( uses_allocator<promise<int>, allocator<int>>::value,
+ "promise supports uses-allocator construction" );