From 8c94c5eb1352ac1db21c82c285cb24826e2e45d4 Mon Sep 17 00:00:00 2001 From: redi Date: Wed, 7 Nov 2012 09:17:42 +0000 Subject: [PATCH] * include/bits/stl_vector.h (vector(size_type)): Add missing allocator parameter. * include/bits/stl_bvector.h: Likewise. * include/debug/vector (vector(size_type)): Likewise. * include/profile/vector (vector(size_type)): Likewise. Pass allocator to base constructor. * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Adjust dg-error line numbers. * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193284 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 17 +++++++++++++++++ libstdc++-v3/include/bits/stl_bvector.h | 16 ++++++++++++++++ libstdc++-v3/include/bits/stl_vector.h | 5 +++-- libstdc++-v3/include/debug/vector | 4 ++-- libstdc++-v3/include/profile/vector | 6 +++--- .../vector/requirements/dr438/assign_neg.cc | 2 +- .../vector/requirements/dr438/constructor_1_neg.cc | 2 +- .../vector/requirements/dr438/constructor_2_neg.cc | 2 +- .../vector/requirements/dr438/insert_neg.cc | 2 +- 9 files changed, 45 insertions(+), 11 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 184efed3525..233f2b96b5b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,20 @@ +2012-11-07 Jonathan Wakely + + * include/bits/stl_vector.h (vector(size_type)): Add missing allocator + parameter. + * include/bits/stl_bvector.h: Likewise. + * include/debug/vector (vector(size_type)): Likewise. + * include/profile/vector (vector(size_type)): Likewise. Pass allocator + to base constructor. + * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: + Adjust dg-error line numbers. + * 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. + 2012-11-06 Paolo Carlini PR libstdc++/51850 diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 3adbfa1ddf2..b8d3efbf651 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -555,6 +555,21 @@ template vector(const allocator_type& __a) : _Base(__a) { } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + explicit + vector(size_type __n, const allocator_type& __a = allocator_type()) + : vector(__n, false, __a) + { } + + vector(size_type __n, const bool& __value, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { + _M_initialize(__n); + std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage, + __value ? ~0 : 0); + } +#else explicit vector(size_type __n, const bool& __value = bool(), const allocator_type& __a = allocator_type()) @@ -564,6 +579,7 @@ template std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage, __value ? ~0 : 0); } +#endif vector(const vector& __x) : _Base(__x._M_get_Bit_allocator()) diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 6e229aa9df2..1f14f7eda7e 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -261,13 +261,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /** * @brief Creates a %vector with default constructed elements. * @param __n The number of elements to initially create. + * @param __a An allocator. * * This constructor fills the %vector with @a __n default * constructed elements. */ explicit - vector(size_type __n) - : _Base(__n) + vector(size_type __n, const allocator_type& __a = allocator_type()) + : _Base(__n, __a) { _M_default_initialize(__n); } /** diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector index 9c33fdf69f9..fe65bab0c7a 100644 --- a/libstdc++-v3/include/debug/vector +++ b/libstdc++-v3/include/debug/vector @@ -83,8 +83,8 @@ namespace __debug #ifdef __GXX_EXPERIMENTAL_CXX0X__ explicit - vector(size_type __n) - : _Base(__n), _M_guaranteed_capacity(__n) { } + vector(size_type __n, const _Allocator& __a = _Allocator()) + : _Base(__n, __a), _M_guaranteed_capacity(__n) { } vector(size_type __n, const _Tp& __value, const _Allocator& __a = _Allocator()) diff --git a/libstdc++-v3/include/profile/vector b/libstdc++-v3/include/profile/vector index fcd69627995..ec931a3bd91 100644 --- a/libstdc++-v3/include/profile/vector +++ b/libstdc++-v3/include/profile/vector @@ -84,8 +84,8 @@ namespace __profile #ifdef __GXX_EXPERIMENTAL_CXX0X__ explicit - vector(size_type __n) - : _Base(__n) + vector(size_type __n, const _Allocator& __a = _Allocator()) + : _Base(__n, __a) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); @@ -147,7 +147,7 @@ namespace __profile } vector(const _Base& __x, const _Allocator& __a) - : _Base(__x) + : _Base(__x, __a) { __profcxx_vector_construct(this, this->capacity()); __profcxx_vector_construct2(this); diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc index 320f4dd0d69..8c009891f5f 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1236 } +// { dg-error "no matching" "" { target *-*-* } 1237 } #include diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc index 78a6ead9be8..e5a46445782 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1166 } +// { dg-error "no matching" "" { target *-*-* } 1167 } #include diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc index af12c6d08f8..9e2924c2f23 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1166 } +// { dg-error "no matching" "" { target *-*-* } 1167 } #include #include diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc index da881801c10..e4bec2668e7 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1277 } +// { dg-error "no matching" "" { target *-*-* } 1278 } #include -- 2.11.4.GIT