+2013-09-17 Marc Glisse <marc.glisse@inria.fr>
+
+ PR libstdc++/58338
+ * include/bits/stl_vector.h (vector::vector(),
+ vector::vector(const allocator_type&)): Merge.
+ (_Vector_impl::_Vector_impl(_Tp_alloc_type const&),
+ _Vector_impl::_Vector_impl(_Tp_alloc_type&&),
+ _Vector_impl::_M_swap_data,
+ _Vector_base::_Vector_base(const allocator_type&),
+ _Vector_base::_Vector_base(allocator_type&&),
+ _Vector_base::_Vector_base(_Vector_base&&), _Vector_base::~_Vector_base,
+ vector::vector(const allocator_type&), vector::operator[],
+ vector::operator[] const, vector::front, vector::front const,
+ vector::back, vector::back const, vector::pop_back,
+ vector::_M_erase_at_end): Mark as noexcept.
+ * include/debug/vector (vector::vector(const _Allocator&),
+ vector::operator[], vector::operator[] const, vector::front,
+ vector::front const, vector::back, vector::back const, vector::pop_back,
+ _M_requires_reallocation, _M_update_guaranteed_capacity,
+ _M_invalidate_after_nth): Mark as noexcept.
+ * include/profile/vector (vector::vector(const _Allocator&),
+ vector::operator[], vector::operator[] const, vector::front,
+ vector::front const, vector::back, vector::back const): Mark as
+ noexcept.
+ (vector::vector(vector&&, const _Allocator&)): Remove wrong noexcept.
+ * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
+ Adjust line number.
+ * testsuite/23_containers/vector/requirements/dr438/
+ constructor_1_neg.cc: Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/
+ constructor_2_neg.cc: Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
+ Likewise.
+
2013-09-14 Tim Shen <timshen91@gmail.com>
* include/bits/regex.h (regex_match<>, regex_search<>):
: _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0)
{ }
- _Vector_impl(_Tp_alloc_type const& __a)
+ _Vector_impl(_Tp_alloc_type const& __a) _GLIBCXX_NOEXCEPT
: _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
{ }
#if __cplusplus >= 201103L
- _Vector_impl(_Tp_alloc_type&& __a)
+ _Vector_impl(_Tp_alloc_type&& __a) noexcept
: _Tp_alloc_type(std::move(__a)),
_M_start(0), _M_finish(0), _M_end_of_storage(0)
{ }
#endif
- void _M_swap_data(_Vector_impl& __x)
+ void _M_swap_data(_Vector_impl& __x) _GLIBCXX_NOEXCEPT
{
std::swap(_M_start, __x._M_start);
std::swap(_M_finish, __x._M_finish);
_Vector_base()
: _M_impl() { }
- _Vector_base(const allocator_type& __a)
+ _Vector_base(const allocator_type& __a) _GLIBCXX_NOEXCEPT
: _M_impl(__a) { }
_Vector_base(size_t __n)
{ _M_create_storage(__n); }
#if __cplusplus >= 201103L
- _Vector_base(_Tp_alloc_type&& __a)
+ _Vector_base(_Tp_alloc_type&& __a) noexcept
: _M_impl(std::move(__a)) { }
- _Vector_base(_Vector_base&& __x)
+ _Vector_base(_Vector_base&& __x) noexcept
: _M_impl(std::move(__x._M_get_Tp_allocator()))
{ this->_M_impl._M_swap_data(__x._M_impl); }
}
#endif
- ~_Vector_base()
+ ~_Vector_base() _GLIBCXX_NOEXCEPT
{ _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage
- this->_M_impl._M_start); }
public:
// [23.2.4.1] construct/copy/destroy
// (assign() and get_allocator() are also listed in this section)
- /**
- * @brief Default constructor creates no elements.
- */
- vector()
- : _Base() { }
-
/**
* @brief Creates a %vector with no elements.
* @param __a An allocator object.
*/
explicit
- vector(const allocator_type& __a)
+ vector(const allocator_type& __a = allocator_type()) _GLIBCXX_NOEXCEPT
: _Base(__a) { }
#if __cplusplus >= 201103L
* see at().)
*/
reference
- operator[](size_type __n)
+ operator[](size_type __n) _GLIBCXX_NOEXCEPT
{ return *(this->_M_impl._M_start + __n); }
/**
* see at().)
*/
const_reference
- operator[](size_type __n) const
+ operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{ return *(this->_M_impl._M_start + __n); }
protected:
* element of the %vector.
*/
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{ return *begin(); }
/**
* element of the %vector.
*/
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{ return *begin(); }
/**
* element of the %vector.
*/
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{ return *(end() - 1); }
/**
* last element of the %vector.
*/
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{ return *(end() - 1); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
* called.
*/
void
- pop_back()
+ pop_back() _GLIBCXX_NOEXCEPT
{
--this->_M_impl._M_finish;
_Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish);
// Called by erase(q1,q2), clear(), resize(), _M_fill_assign,
// _M_assign_aux.
void
- _M_erase_at_end(pointer __pos)
+ _M_erase_at_end(pointer __pos) _GLIBCXX_NOEXCEPT
{
std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator());
this->_M_impl._M_finish = __pos;
// 23.2.4.1 construct/copy/destroy:
explicit
- vector(const _Allocator& __a = _Allocator())
+ vector(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
: _Base(__a), _M_guaranteed_capacity(0) { }
#if __cplusplus >= 201103L
// element access:
reference
- operator[](size_type __n)
+ operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
__glibcxx_check_subscript(__n);
return _M_base()[__n];
}
const_reference
- operator[](size_type __n) const
+ operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_subscript(__n);
return _M_base()[__n];
using _Base::at;
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();
#endif
void
- pop_back()
+ pop_back() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
this->_M_invalidate_if(_Equal(--_Base::end()));
size_type _M_guaranteed_capacity;
bool
- _M_requires_reallocation(size_type __elements)
+ _M_requires_reallocation(size_type __elements) _GLIBCXX_NOEXCEPT
{ return __elements > this->capacity(); }
void
- _M_update_guaranteed_capacity()
+ _M_update_guaranteed_capacity() _GLIBCXX_NOEXCEPT
{
if (this->size() > _M_guaranteed_capacity)
_M_guaranteed_capacity = this->size();
}
void
- _M_invalidate_after_nth(difference_type __n)
+ _M_invalidate_after_nth(difference_type __n) _GLIBCXX_NOEXCEPT
{
typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth;
this->_M_invalidate_if(_After_nth(__n, _Base::begin()));
// 23.2.4.1 construct/copy/destroy:
explicit
- vector(const _Allocator& __a = _Allocator())
+ vector(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
: _Base(__a)
{
__profcxx_vector_construct(this, this->capacity());
__profcxx_vector_construct2(this);
}
- vector(vector&& __x, const _Allocator& __a) noexcept
+ vector(vector&& __x, const _Allocator& __a)
: _Base(std::move(__x), __a)
{
__profcxx_vector_construct(this, this->capacity());
// element access:
reference
- operator[](size_type __n)
+ operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
__profcxx_vector_invalid_operator(this);
return _M_base()[__n];
}
const_reference
- operator[](size_type __n) const
+ operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
__profcxx_vector_invalid_operator(this);
return _M_base()[__n];
using _Base::at;
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{
return _Base::front();
}
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{
return _Base::front();
}
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{
return _Base::back();
}
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{
return _Base::back();
}
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1308 }
+// { dg-error "no matching" "" { target *-*-* } 1302 }
#include <vector>
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1234 }
+// { dg-error "no matching" "" { target *-*-* } 1228 }
#include <vector>
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1234 }
+// { dg-error "no matching" "" { target *-*-* } 1228 }
#include <vector>
#include <utility>
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1349 }
+// { dg-error "no matching" "" { target *-*-* } 1343 }
#include <vector>