diff mbox

[v3] More noexcept for lists

Message ID alpine.DEB.2.02.1309172008570.25880@stedding.saclay.inria.fr
State New
Headers show

Commit Message

Marc Glisse Sept. 17, 2013, 6:44 p.m. UTC
Hello,

after vectors, lists. I didn't touch the throw we were discussing earlier 
today for now. There will be an inconsistency with debug list iterators 
because they use a general wrapper:
- I would need François to tell if that wrapper is ever used with 
iterators that can throw,
- the same wrapper is used for several containers, so unless we change all 
containers at once it can't stay consistent.

Bootstrap+testsuite ok.

2013-09-18  Marc Glisse  <marc.glisse@inria.fr>

 	PR libstdc++/58338
 	* include/bits/list.tcc (_List_base::_M_clear, list::erase): Mark as
 	noexcept.
 	* include/bits/stl_list.h (_List_iterator) [_List_iterator,
 	_M_const_cast, operator*, operator->, operator++, operator--,
 	operator==, operator!=]: Likewise.
 	(_List_const_iterator) [_List_const_iterator, _M_const_cast, operator*,
 	operator->, operator++, operator--, operator==, operator!=]: Likewise.
 	(operator==(const _List_iterator&, const _List_const_iterator&),
 	operator!=(const _List_iterator&, const _List_const_iterator&)):
 	Likewise.
 	(_List_impl) [_List_impl(const _Node_alloc_type&),
 	_List_impl(_Node_alloc_type&&)]: Likewise.
 	(_List_base) [_M_put_node, _List_base(const _Node_alloc_type&),
 	_List_base(_List_base&&), _M_clear, _M_init]: Likewise.
 	(list) [list(), list(const allocator_type&)]: Merge.
 	(list) [list(const allocator_type&), front, back, pop_front, pop_back,
 	erase, _M_erase]: Mark as noexcept.
 	* include/debug/list (list) [list(const _Allocator&), front, back,
 	pop_front, pop_back, _M_erase, erase]: Likewise.
 	* include/profile/list (list) [list(const _Allocator&), front, back,
 	pop_front, pop_back, erase]: Likewise.
 	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
 	Adjust line number.
 	* testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc:
 	Likewise.
 	* testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc:
 	Likewise.
 	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
 	Likewise.

Comments

Paolo Carlini Sept. 18, 2013, 9:38 a.m. UTC | #1
Hi,

On 09/17/2013 08:44 PM, Marc Glisse wrote:
> Hello,
>
> after vectors, lists. I didn't touch the throw we were discussing 
> earlier today for now. There will be an inconsistency with debug list 
> iterators because they use a general wrapper:
> - I would need François to tell if that wrapper is ever used with 
> iterators that can throw,
> - the same wrapper is used for several containers, so unless we change 
> all containers at once it can't stay consistent.
Thus the idea is changing first all the containers and eventually go 
back to __gnu_debug::_Safe_iterator and consistently add the noexcepts 
there? Let's not forget that! (or alternately leave out all the 
iterators related bits for the time being ;)
> Bootstrap+testsuite ok.
Patch is otherwise Ok with me, thanks.

Paolo.
Marc Glisse Sept. 18, 2013, 10:52 a.m. UTC | #2
On Wed, 18 Sep 2013, Paolo Carlini wrote:
> On 09/17/2013 08:44 PM, Marc Glisse wrote:
>> after vectors, lists. I didn't touch the throw we were discussing earlier 
>> today for now. There will be an inconsistency with debug list iterators 
>> because they use a general wrapper:
>> - I would need François to tell if that wrapper is ever used with iterators 
>> that can throw,
>> - the same wrapper is used for several containers, so unless we change all 
>> containers at once it can't stay consistent.
> Thus the idea is changing first all the containers and eventually go back to 
> __gnu_debug::_Safe_iterator and consistently add the noexcepts there?

Yes.

> Let's not forget that! (or alternately leave out all the iterators 
> related bits for the time being ;)

That would mean one mega-patch doing all the iterators at once :-(

> Patch is otherwise Ok with me, thanks.

Ok, I'll commit it now and move to other containers.
diff mbox

Patch

Index: include/bits/list.tcc
===================================================================
--- include/bits/list.tcc	(revision 202655)
+++ include/bits/list.tcc	(working copy)
@@ -56,21 +56,21 @@ 
 #ifndef _LIST_TCC
 #define _LIST_TCC 1
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
   template<typename _Tp, typename _Alloc>
     void
     _List_base<_Tp, _Alloc>::
-    _M_clear()
+    _M_clear() _GLIBCXX_NOEXCEPT
     {
       typedef _List_node<_Tp>  _Node;
       _Node* __cur = static_cast<_Node*>(_M_impl._M_node._M_next);
       while (__cur != &_M_impl._M_node)
 	{
 	  _Node* __tmp = __cur;
 	  __cur = static_cast<_Node*>(__cur->_M_next);
 #if __cplusplus >= 201103L
 	  _M_get_Node_allocator().destroy(__tmp);
 #else
@@ -138,21 +138,21 @@  _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 	    return __it;
 	  }
 	return __position._M_const_cast();
       }
 #endif
 
   template<typename _Tp, typename _Alloc>
     typename list<_Tp, _Alloc>::iterator
     list<_Tp, _Alloc>::
 #if __cplusplus >= 201103L
-    erase(const_iterator __position)
+    erase(const_iterator __position) noexcept
 #else
     erase(iterator __position)
 #endif
     {
       iterator __ret = iterator(__position._M_node->_M_next);
       _M_erase(__position._M_const_cast());
       return __ret;
     }
 
 #if __cplusplus >= 201103L
Index: include/bits/stl_list.h
===================================================================
--- include/bits/stl_list.h	(revision 202655)
+++ include/bits/stl_list.h	(working copy)
@@ -126,76 +126,76 @@  _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
     {
       typedef _List_iterator<_Tp>                _Self;
       typedef _List_node<_Tp>                    _Node;
 
       typedef ptrdiff_t                          difference_type;
       typedef std::bidirectional_iterator_tag    iterator_category;
       typedef _Tp                                value_type;
       typedef _Tp*                               pointer;
       typedef _Tp&                               reference;
 
-      _List_iterator()
+      _List_iterator() _GLIBCXX_NOEXCEPT
       : _M_node() { }
 
       explicit
-      _List_iterator(__detail::_List_node_base* __x)
+      _List_iterator(__detail::_List_node_base* __x) _GLIBCXX_NOEXCEPT
       : _M_node(__x) { }
 
       _Self
-      _M_const_cast() const
+      _M_const_cast() const _GLIBCXX_NOEXCEPT
       { return *this; }
 
       // Must downcast from _List_node_base to _List_node to get to _M_data.
       reference
-      operator*() const
+      operator*() const _GLIBCXX_NOEXCEPT
       { return static_cast<_Node*>(_M_node)->_M_data; }
 
       pointer
-      operator->() const
+      operator->() const _GLIBCXX_NOEXCEPT
       { return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); }
 
       _Self&
-      operator++()
+      operator++() _GLIBCXX_NOEXCEPT
       {
 	_M_node = _M_node->_M_next;
 	return *this;
       }
 
       _Self
-      operator++(int)
+      operator++(int) _GLIBCXX_NOEXCEPT
       {
 	_Self __tmp = *this;
 	_M_node = _M_node->_M_next;
 	return __tmp;
       }
 
       _Self&
-      operator--()
+      operator--() _GLIBCXX_NOEXCEPT
       {
 	_M_node = _M_node->_M_prev;
 	return *this;
       }
 
       _Self
-      operator--(int)
+      operator--(int) _GLIBCXX_NOEXCEPT
       {
 	_Self __tmp = *this;
 	_M_node = _M_node->_M_prev;
 	return __tmp;
       }
 
       bool
-      operator==(const _Self& __x) const
+      operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT
       { return _M_node == __x._M_node; }
 
       bool
-      operator!=(const _Self& __x) const
+      operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT
       { return _M_node != __x._M_node; }
 
       // The only member points to the %list element.
       __detail::_List_node_base* _M_node;
     };
 
   /**
    *  @brief A list::const_iterator.
    *
    *  All the functions are op overloads.
@@ -206,96 +206,97 @@  _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       typedef _List_const_iterator<_Tp>          _Self;
       typedef const _List_node<_Tp>              _Node;
       typedef _List_iterator<_Tp>                iterator;
 
       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()
+      _List_const_iterator() _GLIBCXX_NOEXCEPT
       : _M_node() { }
 
       explicit
       _List_const_iterator(const __detail::_List_node_base* __x)
+      _GLIBCXX_NOEXCEPT
       : _M_node(__x) { }
 
-      _List_const_iterator(const iterator& __x)
+      _List_const_iterator(const iterator& __x) _GLIBCXX_NOEXCEPT
       : _M_node(__x._M_node) { }
 
       iterator
-      _M_const_cast() const
+      _M_const_cast() const _GLIBCXX_NOEXCEPT
       { return iterator(const_cast<__detail::_List_node_base*>(_M_node)); }
 
       // Must downcast from List_node_base to _List_node to get to
       // _M_data.
       reference
-      operator*() const
+      operator*() const _GLIBCXX_NOEXCEPT
       { return static_cast<_Node*>(_M_node)->_M_data; }
 
       pointer
-      operator->() const
+      operator->() const _GLIBCXX_NOEXCEPT
       { return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); }
 
       _Self&
-      operator++()
+      operator++() _GLIBCXX_NOEXCEPT
       {
 	_M_node = _M_node->_M_next;
 	return *this;
       }
 
       _Self
-      operator++(int)
+      operator++(int) _GLIBCXX_NOEXCEPT
       {
 	_Self __tmp = *this;
 	_M_node = _M_node->_M_next;
 	return __tmp;
       }
 
       _Self&
-      operator--()
+      operator--() _GLIBCXX_NOEXCEPT
       {
 	_M_node = _M_node->_M_prev;
 	return *this;
       }
 
       _Self
-      operator--(int)
+      operator--(int) _GLIBCXX_NOEXCEPT
       {
 	_Self __tmp = *this;
 	_M_node = _M_node->_M_prev;
 	return __tmp;
       }
 
       bool
-      operator==(const _Self& __x) const
+      operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT
       { return _M_node == __x._M_node; }
 
       bool
-      operator!=(const _Self& __x) const
+      operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT
       { return _M_node != __x._M_node; }
 
       // The only member points to the %list element.
       const __detail::_List_node_base* _M_node;
     };
 
   template<typename _Val>
     inline bool
     operator==(const _List_iterator<_Val>& __x,
-	       const _List_const_iterator<_Val>& __y)
+	       const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
     { return __x._M_node == __y._M_node; }
 
   template<typename _Val>
     inline bool
     operator!=(const _List_iterator<_Val>& __x,
-               const _List_const_iterator<_Val>& __y)
+               const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
     { return __x._M_node != __y._M_node; }
 
 
   /// See bits/stl_deque.h's _Deque_base for an explanation.
   template<typename _Tp, typename _Alloc>
     class _List_base
     {
     protected:
       // NOTA BENE
       // The stored instance is not actually of "allocator_type"'s
@@ -317,39 +318,39 @@  _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
       struct _List_impl
       : public _Node_alloc_type
       {
 	__detail::_List_node_base _M_node;
 
 	_List_impl()
 	: _Node_alloc_type(), _M_node()
 	{ }
 
-	_List_impl(const _Node_alloc_type& __a)
+	_List_impl(const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
 	: _Node_alloc_type(__a), _M_node()
 	{ }
 
 #if __cplusplus >= 201103L
-	_List_impl(_Node_alloc_type&& __a)
+	_List_impl(_Node_alloc_type&& __a) _GLIBCXX_NOEXCEPT
 	: _Node_alloc_type(std::move(__a)), _M_node()
 	{ }
 #endif
       };
 
       _List_impl _M_impl;
 
       _List_node<_Tp>*
       _M_get_node()
       { return _M_impl._Node_alloc_type::allocate(1); }
 
       void
-      _M_put_node(_List_node<_Tp>* __p)
+      _M_put_node(_List_node<_Tp>* __p) _GLIBCXX_NOEXCEPT
       { _M_impl._Node_alloc_type::deallocate(__p, 1); }
 
   public:
       typedef _Alloc allocator_type;
 
       _Node_alloc_type&
       _M_get_Node_allocator() _GLIBCXX_NOEXCEPT
       { return *static_cast<_Node_alloc_type*>(&_M_impl); }
 
       const _Node_alloc_type&
@@ -361,42 +362,42 @@  _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       { return _Tp_alloc_type(_M_get_Node_allocator()); }
 
       allocator_type
       get_allocator() const _GLIBCXX_NOEXCEPT
       { return allocator_type(_M_get_Node_allocator()); }
 
       _List_base()
       : _M_impl()
       { _M_init(); }
 
-      _List_base(const _Node_alloc_type& __a)
+      _List_base(const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
       : _M_impl(__a)
       { _M_init(); }
 
 #if __cplusplus >= 201103L
-      _List_base(_List_base&& __x)
+      _List_base(_List_base&& __x) noexcept
       : _M_impl(std::move(__x._M_get_Node_allocator()))
       {
 	_M_init();
 	__detail::_List_node_base::swap(_M_impl._M_node, __x._M_impl._M_node);
       }
 #endif
 
       // This is what actually destroys the list.
       ~_List_base() _GLIBCXX_NOEXCEPT
       { _M_clear(); }
 
       void
-      _M_clear();
+      _M_clear() _GLIBCXX_NOEXCEPT;
 
       void
-      _M_init()
+      _M_init() _GLIBCXX_NOEXCEPT
       {
         this->_M_impl._M_node._M_next = &this->_M_impl._M_node;
         this->_M_impl._M_node._M_prev = &this->_M_impl._M_node;
       }
     };
 
   /**
    *  @brief A standard container with linear time access to elements,
    *  and fixed time insertion/deletion at any point in the sequence.
    *
@@ -519,31 +520,25 @@  _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 	      __throw_exception_again;
 	    }
 	  return __p;
 	}
 #endif
 
     public:
       // [23.2.2.1] construct/copy/destroy
       // (assign() and get_allocator() are also listed in this section)
       /**
-       *  @brief  Default constructor creates no elements.
-       */
-      list()
-      : _Base() { }
-
-      /**
        *  @brief  Creates a %list with no elements.
        *  @param  __a  An allocator object.
        */
       explicit
-      list(const allocator_type& __a)
+      list(const allocator_type& __a = allocator_type()) _GLIBCXX_NOEXCEPT
       : _Base(_Node_alloc_type(__a)) { }
 
 #if __cplusplus >= 201103L
       /**
        *  @brief  Creates a %list with default constructed elements.
        *  @param  __n  The number of elements to initially create.
        *
        *  This constructor fills the %list with @a __n default
        *  constructed elements.
        */
@@ -925,49 +920,49 @@  _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       void
       resize(size_type __new_size, value_type __x = value_type());
 #endif
 
       // element access
       /**
        *  Returns a read/write reference to the data at the first
        *  element of the %list.
        */
       reference
-      front()
+      front() _GLIBCXX_NOEXCEPT
       { return *begin(); }
 
       /**
        *  Returns a read-only (constant) reference to the data at the first
        *  element of the %list.
        */
       const_reference
-      front() const
+      front() const _GLIBCXX_NOEXCEPT
       { return *begin(); }
 
       /**
        *  Returns a read/write reference to the data at the last element
        *  of the %list.
        */
       reference
-      back()
+      back() _GLIBCXX_NOEXCEPT
       { 
 	iterator __tmp = end();
 	--__tmp;
 	return *__tmp;
       }
 
       /**
        *  Returns a read-only (constant) reference to the data at the last
        *  element of the %list.
        */
       const_reference
-      back() const
+      back() const _GLIBCXX_NOEXCEPT
       { 
 	const_iterator __tmp = end();
 	--__tmp;
 	return *__tmp;
       }
 
       // [23.2.2.3] modifiers
       /**
        *  @brief  Add data to the front of the %list.
        *  @param  __x  Data to be added.
@@ -999,21 +994,21 @@  _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *  This is a typical stack operation.  It shrinks the %list by
        *  one.  Due to the nature of a %list this operation can be done
        *  in constant time, and only invalidates iterators/references to
        *  the element being removed.
        *
        *  Note that no data is returned, and if the first element's data
        *  is needed, it should be retrieved before pop_front() is
        *  called.
        */
       void
-      pop_front()
+      pop_front() _GLIBCXX_NOEXCEPT
       { this->_M_erase(begin()); }
 
       /**
        *  @brief  Add data to the end of the %list.
        *  @param  __x  Data to be added.
        *
        *  This is a typical stack operation.  The function creates an
        *  element at the end of the %list and assigns the given data to
        *  it.  Due to the nature of a %list this operation can be done
        *  in constant time, and does not invalidate iterators and
@@ -1039,21 +1034,21 @@  _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *
        *  This is a typical stack operation.  It shrinks the %list by
        *  one.  Due to the nature of a %list this operation can be done
        *  in constant time, and only invalidates iterators/references to
        *  the element being removed.
        *
        *  Note that no data is returned, and if the last element's data
        *  is needed, it should be retrieved before pop_back() is called.
        */
       void
-      pop_back()
+      pop_back() _GLIBCXX_NOEXCEPT
       { this->_M_erase(iterator(this->_M_impl._M_node._M_prev)); }
 
 #if __cplusplus >= 201103L
       /**
        *  @brief  Constructs object in %list before specified iterator.
        *  @param  __position  A const_iterator into the %list.
        *  @param  __args  Arguments.
        *  @return  An iterator that points to the inserted data.
        *
        *  This function will insert an object of type T constructed
@@ -1224,21 +1219,21 @@  _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *
        *  Due to the nature of a %list this operation can be done in
        *  constant time, and only invalidates iterators/references to
        *  the element being removed.  The user is also cautioned that
        *  this function only erases the element, and that if the element
        *  is itself a pointer, the pointed-to memory is not touched in
        *  any way.  Managing the pointer is the user's responsibility.
        */
       iterator
 #if __cplusplus >= 201103L
-      erase(const_iterator __position);
+      erase(const_iterator __position) noexcept;
 #else
       erase(iterator __position);
 #endif
 
       /**
        *  @brief  Remove a range of elements.
        *  @param  __first  Iterator pointing to the first element to be erased.
        *  @param  __last  Iterator pointing to one past the last element to be
        *                erased.
        *  @return  An iterator pointing to the element pointed to by @a last
@@ -1249,21 +1244,21 @@  _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        *
        *  This operation is linear time in the size of the range and only
        *  invalidates iterators/references to the element being removed.
        *  The user is also cautioned that this function only erases the
        *  elements, and that if the elements themselves are pointers, the
        *  pointed-to memory is not touched in any way.  Managing the pointer
        *  is the user's responsibility.
        */
       iterator
 #if __cplusplus >= 201103L
-      erase(const_iterator __first, const_iterator __last)
+      erase(const_iterator __first, const_iterator __last) noexcept
 #else
       erase(iterator __first, iterator __last)
 #endif
       {
 	while (__first != __last)
 	  __first = erase(__first);
 	return __last._M_const_cast();
       }
 
       /**
@@ -1680,21 +1675,21 @@  _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
        void
        _M_insert(iterator __position, _Args&&... __args)
        {
 	 _Node* __tmp = _M_create_node(std::forward<_Args>(__args)...);
 	 __tmp->_M_hook(__position._M_node);
        }
 #endif
 
       // Erases element at position given.
       void
-      _M_erase(iterator __position)
+      _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
       {
         __position._M_node->_M_unhook();
         _Node* __n = static_cast<_Node*>(__position._M_node);
 #if __cplusplus >= 201103L
         _M_get_Node_allocator().destroy(__n);
 #else
 	_M_get_Tp_allocator().destroy(std::__addressof(__n->_M_data));
 #endif
         _M_put_node(__n);
       }
Index: include/debug/list
===================================================================
--- include/debug/list	(revision 202655)
+++ include/debug/list	(working copy)
@@ -63,21 +63,21 @@  namespace __debug
 
       typedef _Tp				    value_type;
       typedef _Allocator			    allocator_type;
       typedef typename _Base::pointer               pointer;
       typedef typename _Base::const_pointer         const_pointer;
       typedef std::reverse_iterator<iterator>       reverse_iterator;
       typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
 
       // 23.2.2.1 construct/copy/destroy:
       explicit
-      list(const _Allocator& __a = _Allocator())
+      list(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
       : _Base(__a) { }
 
 #if __cplusplus >= 201103L
       explicit
       list(size_type __n)
       : _Base(__n) { }
 
       list(size_type __n, const _Tp& __value,
 	   const _Allocator& __a = _Allocator())
       : _Base(__n, __value, __a) { }
@@ -313,70 +313,70 @@  namespace __debug
 	__catch(...)
 	  {
 	    this->_M_revalidate_singular();
 	    __throw_exception_again;
 	  }
       }
 #endif
 
       // element access:
       reference
-      front()
+      front() _GLIBCXX_NOEXCEPT
       {
 	__glibcxx_check_nonempty();
 	return _Base::front();
       }
 
       const_reference
-      front() const
+      front() const _GLIBCXX_NOEXCEPT
       {
 	__glibcxx_check_nonempty();
 	return _Base::front();
       }
 
       reference
-      back()
+      back() _GLIBCXX_NOEXCEPT
       {
 	__glibcxx_check_nonempty();
 	return _Base::back();
       }
 
       const_reference
-      back() const
+      back() const _GLIBCXX_NOEXCEPT
       {
 	__glibcxx_check_nonempty();
 	return _Base::back();
       }
 
       // 23.2.2.3 modifiers:
       using _Base::push_front;
 
 #if __cplusplus >= 201103L
       using _Base::emplace_front;
 #endif
 
       void
-      pop_front()
+      pop_front() _GLIBCXX_NOEXCEPT
       {
 	__glibcxx_check_nonempty();
 	this->_M_invalidate_if(_Equal(_Base::begin()));
 	_Base::pop_front();
       }
 
       using _Base::push_back;
 
 #if __cplusplus >= 201103L
       using _Base::emplace_back;
 #endif
 
       void
-      pop_back()
+      pop_back() _GLIBCXX_NOEXCEPT
       {
 	__glibcxx_check_nonempty();
 	this->_M_invalidate_if(_Equal(--_Base::end()));
 	_Base::pop_back();
       }
 
 #if __cplusplus >= 201103L
       template<typename... _Args>
         iterator
         emplace(const_iterator __position, _Args&&... __args)
@@ -448,44 +448,44 @@  namespace __debug
         {
 	  __glibcxx_check_insert_range(__position, __first, __last);
 	  _Base::insert(__position.base(), __gnu_debug::__base(__first),
 					   __gnu_debug::__base(__last));
 	}
 #endif
 
     private:
       _Base_iterator
 #if __cplusplus >= 201103L
-      _M_erase(_Base_const_iterator __position)
+      _M_erase(_Base_const_iterator __position) noexcept
 #else
       _M_erase(_Base_iterator __position)
 #endif
       {
 	this->_M_invalidate_if(_Equal(__position));
 	return _Base::erase(__position);
       }
 
     public:
       iterator
 #if __cplusplus >= 201103L
-      erase(const_iterator __position)
+      erase(const_iterator __position) noexcept
 #else
       erase(iterator __position)
 #endif
       {
 	__glibcxx_check_erase(__position);
 	return iterator(_M_erase(__position.base()), this);
       }
 
       iterator
 #if __cplusplus >= 201103L
-      erase(const_iterator __first, const_iterator __last)
+      erase(const_iterator __first, const_iterator __last) noexcept
 #else
       erase(iterator __first, iterator __last)
 #endif
       {
 	// _GLIBCXX_RESOLVE_LIB_DEFECTS
 	// 151. can't currently clear() empty container
 	__glibcxx_check_erase_range(__first, __last);
 	for (_Base_const_iterator __victim = __first.base();
 	     __victim != __last.base(); ++__victim)
 	  {
Index: include/profile/list
===================================================================
--- include/profile/list	(revision 202655)
+++ include/profile/list	(working copy)
@@ -58,21 +58,21 @@  template<typename _Tp, typename _Allocat
 
       typedef _Tp				    value_type;
       typedef _Allocator			    allocator_type;
       typedef typename _Base::pointer               pointer;
       typedef typename _Base::const_pointer         const_pointer;
       typedef std::reverse_iterator<iterator>       reverse_iterator;
       typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
 
       // 23.2.2.1 construct/copy/destroy:
       explicit
-      list(const _Allocator& __a = _Allocator())
+      list(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
       : _Base(__a) 
       {
         __profcxx_list_construct(this); 	// list2slist
         __profcxx_list_construct2(this); 	// list2vector
       }
 
 #if __cplusplus >= 201103L
       explicit
       list(size_type __n)
       : _Base(__n) 
@@ -269,69 +269,69 @@  template<typename _Tp, typename _Allocat
       resize(size_type __sz, const _Tp& __c)
       { _Base::resize(__sz, __c); }
 #else
       void
       resize(size_type __sz, _Tp __c = _Tp())
       { _Base::resize(__sz, __c); }
 #endif
 
       // element access:
       reference
-      front()
+      front() _GLIBCXX_NOEXCEPT
       { return _Base::front(); }
 
       const_reference
-      front() const
+      front() const _GLIBCXX_NOEXCEPT
       { return _Base::front(); }
 
       reference
-      back()
+      back() _GLIBCXX_NOEXCEPT
       {
         __profcxx_list_rewind(this);
 	return _Base::back();
       }
 
       const_reference
-      back() const
+      back() const _GLIBCXX_NOEXCEPT
       {
         __profcxx_list_rewind(this);
 	return _Base::back();
       }
 
       // 23.2.2.3 modifiers:
       void
       push_front(const value_type& __x)
       {
         __profcxx_list_invalid_operator(this);
         __profcxx_list_operation(this);
         _Base::push_front(__x);
       }
 
 #if __cplusplus >= 201103L
       using _Base::emplace_front;
 #endif
 
       void
-      pop_front()
+      pop_front() _GLIBCXX_NOEXCEPT
       {
         __profcxx_list_operation(this);
 	_Base::pop_front();
       }
 
       using _Base::push_back;
 
 #if __cplusplus >= 201103L
       using _Base::emplace_back;
 #endif
 
       void
-      pop_back()
+      pop_back() _GLIBCXX_NOEXCEPT
       {
 	iterator __victim = end();
 	--__victim;
 	_Base::pop_back();
         __profcxx_list_rewind(this);
       }
 
 #if __cplusplus >= 201103L
       template<typename... _Args>
         iterator
@@ -404,29 +404,29 @@  template<typename _Tp, typename _Allocat
         insert(iterator __position, _InputIterator __first,
 	       _InputIterator __last)
 	{
 	  _M_profile_insert(this, __position, size());
 	  _Base::insert(__position.base(), __first, __last);
 	}
 #endif
 
       iterator
 #if __cplusplus >= 201103L
-      erase(const_iterator __position)
+      erase(const_iterator __position) noexcept
 #else
       erase(iterator __position)
 #endif
       {	return iterator(_Base::erase(__position.base()), this); }
 
       iterator
 #if __cplusplus >= 201103L
-      erase(const_iterator __position, const_iterator __last)
+      erase(const_iterator __position, const_iterator __last) noexcept
 #else
       erase(iterator __position, iterator __last)
 #endif
       {
 	// _GLIBCXX_RESOLVE_LIB_DEFECTS
 	// 151. can't currently clear() empty container
 	return iterator(_Base::erase(__position.base(), __last.base()), this);
       }
 
       void
Index: testsuite/23_containers/list/requirements/dr438/assign_neg.cc
===================================================================
--- testsuite/23_containers/list/requirements/dr438/assign_neg.cc	(revision 202655)
+++ testsuite/23_containers/list/requirements/dr438/assign_neg.cc	(working copy)
@@ -11,21 +11,21 @@ 
 // 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-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1651 }
+// { dg-error "no matching" "" { target *-*-* } 1646 }
 
 #include <list>
 
 struct A
 {
   explicit A(int) { }
 };
 
 void f()
 {
Index: testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
===================================================================
--- testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc	(revision 202655)
+++ testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc	(working copy)
@@ -11,19 +11,19 @@ 
 // 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-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1603 }
+// { dg-error "no matching" "" { target *-*-* } 1598 }
 
 #include <list>
 
 void f()
 {
   typedef std::list<std::list<int> > list_type;
   list_type l(10, 1);
 }
Index: testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
===================================================================
--- testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc	(revision 202655)
+++ testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc	(working copy)
@@ -11,20 +11,20 @@ 
 // 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-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1603 }
+// { dg-error "no matching" "" { target *-*-* } 1598 }
 
 #include <list>
 #include <utility>
 
 void f()
 {
   typedef std::list<std::list<std::pair<char, char> > > list_type;
   list_type l('a', 'b');
 }
Index: testsuite/23_containers/list/requirements/dr438/insert_neg.cc
===================================================================
--- testsuite/23_containers/list/requirements/dr438/insert_neg.cc	(revision 202655)
+++ testsuite/23_containers/list/requirements/dr438/insert_neg.cc	(working copy)
@@ -11,21 +11,21 @@ 
 // 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-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1603 }
+// { dg-error "no matching" "" { target *-*-* } 1598 }
 
 #include <list>
 
 struct A
 {
   explicit A(int) { }
 };
 
 void f()
 {