From ff15f019e014d1d41e4a78d289f4f61873d62bd8 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 29 Aug 2011 13:40:33 +0000 Subject: [PATCH] re PR libstdc++/50118 (node-based containers cannot use allocators with explicit constructor template) 2011-08-29 Paolo Carlini PR libstdc++/50118 * include/bits/stl_list.h (_List_base<>:: _List_base(const allocator_type&)): Remove. (_List_base<>::_List_base(const _Node_alloc_type&)): Add. (list<>:list(const allocator_type&), list(size_type, const value_type&, const allocator_type&), list(initializer_list<, const allocator_type&), list(_InputIterator, _InputIterator, const allocator_type&), insert(iterator, size_type, const value_type&), insert(iterator, _InputIterator, _InputIterator)): Adjust. * include/bits/stl_tree.h (_Rb_tree<>::_Rb_tree(const _Compare&, const allocator_type&)): Fix. * include/bits/stl_map.h (map<>::map(const _Compare&, const allocator_type&), map(initializer_list<>, const _Compare&, const allocator_type&), map(_InputIterator, _InputIterator, const _Compare&, const allocator_type&), get_allocator): Adjust. * include/bits/stl_set.h (set<>::set(const _Compare&, const allocator_type&), set(initializer_list<>, const _Compare&, const allocator_type&), set(_InputIterator, _InputIterator, const _Compare&, const allocator_type&), get_allocator): Likewise. * include/bits/stl_multimap.h (multimap<>::multimap(const _Compare&, const allocator_type&), multimap(initializer_list<>, const _Compare&, const allocator_type&), multimap(_InputIterator, _InputIterator, const _Compare&, const allocator_type&), get_allocator): Likewise. * include/bits/stl_multiset.h (multiset<>::multiset(const _Compare&, const allocator_type&), multiset(initializer_list<>, const _Compare&, const allocator_type&), multiset(_InputIterator, _InputIterator, const _Compare&, const allocator_type&), get_allocator): Likewise. * include/bits/forward_list.h (_Fwd_list_base<>:: _Fwd_list_base(const _Alloc&), _Fwd_list_base(const _Fwd_list_base&, const _Alloc&), _Fwd_list_base(_Fwd_list_base&&, const _Alloc&)): Remove. (_Fwd_list_base<>::_Fwd_list_base(const _Node_alloc_type&), _Fwd_list_base(const _Fwd_list_base&, const _Node_alloc_type&), _Fwd_list_base(_Fwd_list_base&&, const _Node_alloc_type&)): Add. (forward_list<>::forward_list(const _Alloc&), forward_list(const forward_list&, const _Alloc&), forward_list(forward_list&&, const _Alloc&), forward_list(size_type, const _Tp&, const _Alloc&), forward_list(_InputIterator, _InputIterator, const _Alloc&), forward_list(std::initializer_list<>, const _Alloc&), get_allocator): Adjust. * include/bits/forward_list.tcc * testsuite/util/testsuite_allocator.h (ExplicitConsAlloc): Add. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation/5.cc: New. * testsuite/23_containers/multimap/requirements/ explicit_instantiation/5.cc: Likewise. * testsuite/23_containers/multimap/requirements/ explicit_instantiation/5_c++0x.cc: Likewise. * testsuite/23_containers/set/requirements/explicit_instantiation/ 5.cc: Likewise. * testsuite/23_containers/set/requirements/explicit_instantiation/ 5_c++0x.cc: Likewise. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation/5.cc: Likewise. * testsuite/23_containers/forward_list/requirements/ explicit_instantiation/5.cc: Likewise. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation/5.cc: Likewise. testsuite/23_containers/multiset/requirements/explicit_instantiation/ 5.cc: Likewise. * testsuite/23_containers/multiset/requirements/ explicit_instantiation/5_c++0x.cc: Likewise. * testsuite/23_containers/list/requirements/explicit_instantiation/ 5_c++0x.cc: Likewise. * testsuite/23_containers/list/requirements/explicit_instantiation/ 5.cc: Likewise. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation/5.cc: Likewise. * testsuite/23_containers/map/requirements/explicit_instantiation/ 5.cc: Likewise. * testsuite/23_containers/map/requirements/explicit_instantiation/ 5_c++0x.cc: Likewise. * testsuite/23_containers/forward_list/requirements/dr438/ assign_neg.cc: Adjust dg-error line number. * testsuite/23_containers/forward_list/requirements/dr438/ insert_neg.cc: Likewise. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_2_neg.cc: Likewise. From-SVN: r178230 --- libstdc++-v3/ChangeLog | 98 +++++++++++++++++++ libstdc++-v3/include/bits/forward_list.h | 21 ++-- libstdc++-v3/include/bits/forward_list.tcc | 8 +- libstdc++-v3/include/bits/stl_list.h | 19 ++-- libstdc++-v3/include/bits/stl_map.h | 8 +- libstdc++-v3/include/bits/stl_multimap.h | 8 +- libstdc++-v3/include/bits/stl_multiset.h | 8 +- libstdc++-v3/include/bits/stl_set.h | 10 +- libstdc++-v3/include/bits/stl_tree.h | 2 +- .../requirements/dr438/assign_neg.cc | 4 +- .../requirements/dr438/constructor_1_neg.cc | 2 +- .../requirements/dr438/constructor_2_neg.cc | 2 +- .../requirements/dr438/insert_neg.cc | 2 +- .../requirements/explicit_instantiation/5.cc | 29 ++++++ .../list/requirements/dr438/assign_neg.cc | 2 +- .../requirements/dr438/constructor_1_neg.cc | 2 +- .../requirements/dr438/constructor_2_neg.cc | 2 +- .../list/requirements/dr438/insert_neg.cc | 2 +- .../requirements/explicit_instantiation/5.cc | 27 +++++ .../explicit_instantiation/5_c++0x.cc | 29 ++++++ .../requirements/explicit_instantiation/5.cc | 29 ++++++ .../explicit_instantiation/5_c++0x.cc | 31 ++++++ .../requirements/explicit_instantiation/5.cc | 29 ++++++ .../explicit_instantiation/5_c++0x.cc | 31 ++++++ .../requirements/explicit_instantiation/5.cc | 29 ++++++ .../explicit_instantiation/5_c++0x.cc | 31 ++++++ .../requirements/explicit_instantiation/5.cc | 29 ++++++ .../explicit_instantiation/5_c++0x.cc | 31 ++++++ .../requirements/explicit_instantiation/5.cc | 31 ++++++ .../requirements/explicit_instantiation/5.cc | 33 +++++++ .../requirements/explicit_instantiation/5.cc | 31 ++++++ .../requirements/explicit_instantiation/5.cc | 31 ++++++ .../testsuite/util/testsuite_allocator.h | 14 +++ 33 files changed, 615 insertions(+), 50 deletions(-) create mode 100644 libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/5.cc create mode 100644 libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/5.cc create mode 100644 libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/5_c++0x.cc create mode 100644 libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/5.cc create mode 100644 libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/5_c++0x.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/5.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/5_c++0x.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/5.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/5_c++0x.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/5.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/5_c++0x.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/5.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/5.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/5.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/5.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index bc745b6924e..e6c3db06a78 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,101 @@ +2011-08-29 Paolo Carlini + + PR libstdc++/50118 + * include/bits/stl_list.h (_List_base<>:: + _List_base(const allocator_type&)): Remove. + (_List_base<>::_List_base(const _Node_alloc_type&)): Add. + (list<>:list(const allocator_type&), list(size_type, const + value_type&, const allocator_type&), + list(initializer_list<, const allocator_type&), + list(_InputIterator, _InputIterator, const allocator_type&), + insert(iterator, size_type, const value_type&), + insert(iterator, _InputIterator, _InputIterator)): Adjust. + * include/bits/stl_tree.h (_Rb_tree<>::_Rb_tree(const _Compare&, + const allocator_type&)): Fix. + * include/bits/stl_map.h (map<>::map(const _Compare&, + const allocator_type&), map(initializer_list<>, + const _Compare&, const allocator_type&), map(_InputIterator, + _InputIterator, const _Compare&, const allocator_type&), + get_allocator): Adjust. + * include/bits/stl_set.h (set<>::set(const _Compare&, + const allocator_type&), set(initializer_list<>, + const _Compare&, const allocator_type&), set(_InputIterator, + _InputIterator, const _Compare&, const allocator_type&), + get_allocator): Likewise. + * include/bits/stl_multimap.h (multimap<>::multimap(const _Compare&, + const allocator_type&), multimap(initializer_list<>, + const _Compare&, const allocator_type&), multimap(_InputIterator, + _InputIterator, const _Compare&, const allocator_type&), + get_allocator): Likewise. + * include/bits/stl_multiset.h (multiset<>::multiset(const _Compare&, + const allocator_type&), multiset(initializer_list<>, + const _Compare&, const allocator_type&), multiset(_InputIterator, + _InputIterator, const _Compare&, const allocator_type&), + get_allocator): Likewise. + * include/bits/forward_list.h (_Fwd_list_base<>:: + _Fwd_list_base(const _Alloc&), _Fwd_list_base(const _Fwd_list_base&, + const _Alloc&), _Fwd_list_base(_Fwd_list_base&&, const _Alloc&)): + Remove. + (_Fwd_list_base<>::_Fwd_list_base(const _Node_alloc_type&), + _Fwd_list_base(const _Fwd_list_base&, + const _Node_alloc_type&), _Fwd_list_base(_Fwd_list_base&&, + const _Node_alloc_type&)): Add. + (forward_list<>::forward_list(const _Alloc&), + forward_list(const forward_list&, const _Alloc&), + forward_list(forward_list&&, const _Alloc&), + forward_list(size_type, const _Tp&, const _Alloc&), + forward_list(_InputIterator, _InputIterator, const _Alloc&), + forward_list(std::initializer_list<>, const _Alloc&), + get_allocator): Adjust. + * include/bits/forward_list.tcc + * testsuite/util/testsuite_allocator.h (ExplicitConsAlloc): Add. + * testsuite/23_containers/unordered_map/requirements/ + explicit_instantiation/5.cc: New. + * testsuite/23_containers/multimap/requirements/ + explicit_instantiation/5.cc: Likewise. + * testsuite/23_containers/multimap/requirements/ + explicit_instantiation/5_c++0x.cc: Likewise. + * testsuite/23_containers/set/requirements/explicit_instantiation/ + 5.cc: Likewise. + * testsuite/23_containers/set/requirements/explicit_instantiation/ + 5_c++0x.cc: Likewise. + * testsuite/23_containers/unordered_multimap/requirements/ + explicit_instantiation/5.cc: Likewise. + * testsuite/23_containers/forward_list/requirements/ + explicit_instantiation/5.cc: Likewise. + * testsuite/23_containers/unordered_set/requirements/ + explicit_instantiation/5.cc: Likewise. + testsuite/23_containers/multiset/requirements/explicit_instantiation/ + 5.cc: Likewise. + * testsuite/23_containers/multiset/requirements/ + explicit_instantiation/5_c++0x.cc: Likewise. + * testsuite/23_containers/list/requirements/explicit_instantiation/ + 5_c++0x.cc: Likewise. + * testsuite/23_containers/list/requirements/explicit_instantiation/ + 5.cc: Likewise. + * testsuite/23_containers/unordered_multiset/requirements/ + explicit_instantiation/5.cc: Likewise. + * testsuite/23_containers/map/requirements/explicit_instantiation/ + 5.cc: Likewise. + * testsuite/23_containers/map/requirements/explicit_instantiation/ + 5_c++0x.cc: Likewise. + * testsuite/23_containers/forward_list/requirements/dr438/ + assign_neg.cc: Adjust dg-error line number. + * testsuite/23_containers/forward_list/requirements/dr438/ + insert_neg.cc: Likewise. + * testsuite/23_containers/forward_list/requirements/dr438/ + constructor_1_neg.cc: Likewise. + * testsuite/23_containers/forward_list/requirements/dr438/ + constructor_2_neg.cc: Likewise. + * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: + Likewise. + * testsuite/23_containers/list/requirements/dr438/insert_neg.cc: + Likewise. + * testsuite/23_containers/list/requirements/dr438/ + constructor_1_neg.cc: Likewise. + * testsuite/23_containers/list/requirements/dr438/ + constructor_2_neg.cc: Likewise. + 2011-08-29 Rainer Orth * acinclude.m4 (GLIBCXX_CHECK_MATH_PROTO) diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h index b612424396e..c80ee508757 100644 --- a/libstdc++-v3/include/bits/forward_list.h +++ b/libstdc++-v3/include/bits/forward_list.h @@ -314,12 +314,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _Fwd_list_base() : _M_impl() { } - _Fwd_list_base(const _Alloc& __a) + _Fwd_list_base(const _Node_alloc_type& __a) : _M_impl(__a) { } - _Fwd_list_base(const _Fwd_list_base& __lst, const _Alloc& __a); + _Fwd_list_base(const _Fwd_list_base& __lst, const _Node_alloc_type& __a); - _Fwd_list_base(_Fwd_list_base&& __lst, const _Alloc& __a) + _Fwd_list_base(_Fwd_list_base&& __lst, const _Node_alloc_type& __a) : _M_impl(__a) { this->_M_impl._M_head._M_next = __lst._M_impl._M_head._M_next; @@ -416,6 +416,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef _Fwd_list_node<_Tp> _Node; typedef _Fwd_list_node_base _Node_base; typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; + typedef typename _Base::_Node_alloc_type _Node_alloc_type; public: // types: @@ -439,7 +440,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ explicit forward_list(const _Alloc& __al = _Alloc()) - : _Base(__al) + : _Base(_Node_alloc_type(__al)) { } /** @@ -448,7 +449,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * @param __al An allocator object. */ forward_list(const forward_list& __list, const _Alloc& __al) - : _Base(__list, __al) + : _Base(__list, _Node_alloc_type(__al)) { } /** @@ -457,7 +458,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER * @param __al An allocator object. */ forward_list(forward_list&& __list, const _Alloc& __al) - : _Base(std::move(__list), __al) + : _Base(std::move(__list), _Node_alloc_type(__al)) { } /** @@ -483,7 +484,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ forward_list(size_type __n, const _Tp& __value, const _Alloc& __al = _Alloc()) - : _Base(__al) + : _Base(_Node_alloc_type(__al)) { _M_fill_initialize(__n, __value); } /** @@ -499,7 +500,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER template forward_list(_InputIterator __first, _InputIterator __last, const _Alloc& __al = _Alloc()) - : _Base(__al) + : _Base(_Node_alloc_type(__al)) { // Check whether it's an integral type. If so, it's not an iterator. typedef typename std::__is_integer<_InputIterator>::__type _Integral; @@ -540,7 +541,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ forward_list(std::initializer_list<_Tp> __il, const _Alloc& __al = _Alloc()) - : _Base(__al) + : _Base(_Node_alloc_type(__al)) { _M_initialize_dispatch(__il.begin(), __il.end(), __false_type()); } /** @@ -649,7 +650,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /// Get a copy of the memory allocation object. allocator_type get_allocator() const noexcept - { return this->_M_get_Node_allocator(); } + { return allocator_type(this->_M_get_Node_allocator()); } // 23.2.3.2 iterators: diff --git a/libstdc++-v3/include/bits/forward_list.tcc b/libstdc++-v3/include/bits/forward_list.tcc index 2c319db7c1e..83f32c4e299 100644 --- a/libstdc++-v3/include/bits/forward_list.tcc +++ b/libstdc++-v3/include/bits/forward_list.tcc @@ -36,7 +36,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER template _Fwd_list_base<_Tp, _Alloc>:: - _Fwd_list_base(const _Fwd_list_base& __lst, const _Alloc& __a) + _Fwd_list_base(const _Fwd_list_base& __lst, const _Node_alloc_type& __a) : _M_impl(__a) { this->_M_impl._M_head._M_next = 0; @@ -250,7 +250,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { if (__n) { - forward_list __tmp(__n, __val, this->_M_get_Node_allocator()); + forward_list __tmp(__n, __val, get_allocator()); return _M_splice_after(__pos, std::move(__tmp)); } else @@ -264,7 +264,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert_after(const_iterator __pos, _InputIterator __first, _InputIterator __last) { - forward_list __tmp(__first, __last, this->_M_get_Node_allocator()); + forward_list __tmp(__first, __last, get_allocator()); if (!__tmp.empty()) return _M_splice_after(__pos, std::move(__tmp)); else @@ -278,7 +278,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { if (__il.size()) { - forward_list __tmp(__il, this->_M_get_Node_allocator()); + forward_list __tmp(__il, get_allocator()); return _M_splice_after(__pos, std::move(__tmp)); } else diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index 24a79cbf235..91e39f3256c 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -359,7 +359,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER : _M_impl() { _M_init(); } - _List_base(const allocator_type& __a) + _List_base(const _Node_alloc_type& __a) : _M_impl(__a) { _M_init(); } @@ -441,6 +441,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef _List_base<_Tp, _Alloc> _Base; typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; + typedef typename _Base::_Node_alloc_type _Node_alloc_type; public: typedef _Tp value_type; @@ -525,7 +526,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ explicit list(const allocator_type& __a) - : _Base(__a) { } + : _Base(_Node_alloc_type(__a)) { } #ifdef __GXX_EXPERIMENTAL_CXX0X__ /** @@ -550,7 +551,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ list(size_type __n, const value_type& __value, const allocator_type& __a = allocator_type()) - : _Base(__a) + : _Base(_Node_alloc_type(__a)) { _M_fill_initialize(__n, __value); } #else /** @@ -564,7 +565,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER explicit list(size_type __n, const value_type& __value = value_type(), const allocator_type& __a = allocator_type()) - : _Base(__a) + : _Base(_Node_alloc_type(__a)) { _M_fill_initialize(__n, __value); } #endif @@ -600,7 +601,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ list(initializer_list __l, const allocator_type& __a = allocator_type()) - : _Base(__a) + : _Base(_Node_alloc_type(__a)) { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); } #endif @@ -617,7 +618,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER template list(_InputIterator __first, _InputIterator __last, const allocator_type& __a = allocator_type()) - : _Base(__a) + : _Base(_Node_alloc_type(__a)) { // Check whether it's an integral type. If so, it's not an iterator. typedef typename std::__is_integer<_InputIterator>::__type _Integral; @@ -1100,8 +1101,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ void insert(iterator __position, size_type __n, const value_type& __x) - { - list __tmp(__n, __x, _M_get_Node_allocator()); + { + list __tmp(__n, __x, get_allocator()); splice(__position, __tmp); } @@ -1123,7 +1124,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert(iterator __position, _InputIterator __first, _InputIterator __last) { - list __tmp(__first, __last, _M_get_Node_allocator()); + list __tmp(__first, __last, get_allocator()); splice(__position, __tmp); } diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index 0501b25ae76..889e52b388a 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -160,7 +160,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER explicit map(const _Compare& __comp, const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) { } + : _M_t(__comp, _Pair_alloc_type(__a)) { } /** * @brief %Map copy constructor. @@ -198,7 +198,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER map(initializer_list __l, const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) + : _M_t(__comp, _Pair_alloc_type(__a)) { _M_t._M_insert_unique(__l.begin(), __l.end()); } #endif @@ -233,7 +233,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER map(_InputIterator __first, _InputIterator __last, const _Compare& __comp, const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) + : _M_t(__comp, _Pair_alloc_type(__a)) { _M_t._M_insert_unique(__first, __last); } // FIXME There is no dtor declared, but we should have something @@ -300,7 +300,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /// Get a copy of the memory allocation object. allocator_type get_allocator() const _GLIBCXX_NOEXCEPT - { return _M_t.get_allocator(); } + { return allocator_type(_M_t.get_allocator()); } // iterators /** diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index baa8b4e09db..6b74558948c 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -158,7 +158,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER explicit multimap(const _Compare& __comp, const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) { } + : _M_t(__comp, _Pair_alloc_type(__a)) { } /** * @brief %Multimap copy constructor. @@ -195,7 +195,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER multimap(initializer_list __l, const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) + : _M_t(__comp, _Pair_alloc_type(__a)) { _M_t._M_insert_equal(__l.begin(), __l.end()); } #endif @@ -228,7 +228,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER multimap(_InputIterator __first, _InputIterator __last, const _Compare& __comp, const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) + : _M_t(__comp, _Pair_alloc_type(__a)) { _M_t._M_insert_equal(__first, __last); } // FIXME There is no dtor declared, but we should have something generated @@ -295,7 +295,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /// Get a copy of the memory allocation object. allocator_type get_allocator() const _GLIBCXX_NOEXCEPT - { return _M_t.get_allocator(); } + { return allocator_type(_M_t.get_allocator()); } // iterators /** diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index 7c307ee60d2..8b25a975480 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -139,7 +139,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER explicit multiset(const _Compare& __comp, const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) { } + : _M_t(__comp, _Key_alloc_type(__a)) { } /** * @brief Builds a %multiset from a range. @@ -170,7 +170,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER multiset(_InputIterator __first, _InputIterator __last, const _Compare& __comp, const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) + : _M_t(__comp, _Key_alloc_type(__a)) { _M_t._M_insert_equal(__first, __last); } /** @@ -208,7 +208,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER multiset(initializer_list __l, const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) + : _M_t(__comp, _Key_alloc_type(__a)) { _M_t._M_insert_equal(__l.begin(), __l.end()); } #endif @@ -278,7 +278,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /// Returns the memory allocation object. allocator_type get_allocator() const _GLIBCXX_NOEXCEPT - { return _M_t.get_allocator(); } + { return allocator_type(_M_t.get_allocator()); } /** * Returns a read-only (constant) iterator that points to the first diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index 85361d6a05c..b30966a2292 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -146,7 +146,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER explicit set(const _Compare& __comp, const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) { } + : _M_t(__comp, _Key_alloc_type(__a)) { } /** * @brief Builds a %set from a range. @@ -179,8 +179,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER set(_InputIterator __first, _InputIterator __last, const _Compare& __comp, const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) - { _M_t._M_insert_unique(__first, __last); } + : _M_t(__comp, _Key_alloc_type(__a)) + { _M_t._M_insert_unique(__first, __last); } /** * @brief %Set copy constructor. @@ -217,7 +217,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER set(initializer_list __l, const _Compare& __comp = _Compare(), const allocator_type& __a = allocator_type()) - : _M_t(__comp, __a) + : _M_t(__comp, _Key_alloc_type(__a)) { _M_t._M_insert_unique(__l.begin(), __l.end()); } #endif @@ -286,7 +286,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /// Returns the allocator object with which the %set was constructed. allocator_type get_allocator() const _GLIBCXX_NOEXCEPT - { return _M_t.get_allocator(); } + { return allocator_type(_M_t.get_allocator()); } /** * Returns a read-only (constant) iterator that points to the first diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index 3b291c5bdb9..8c5f0c30a0f 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -624,7 +624,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Rb_tree(const _Compare& __comp, const allocator_type& __a = allocator_type()) - : _M_impl(__comp, __a) { } + : _M_impl(__comp, _Node_allocator(__a)) { } _Rb_tree(const _Rb_tree& __x) : _M_impl(__x._M_impl._M_key_compare, __x._M_get_Node_allocator()) diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc index a2be5cfc0dc..7dd46e1fb48 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc @@ -1,8 +1,8 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// { dg-error "no matching" "" { target *-*-* } 1210 } +// { dg-error "no matching" "" { target *-*-* } 1211 } -// Copyright (C) 2009, 2010 Free Software Foundation +// Copyright (C) 2009, 2010, 2011 Free Software Foundation // // 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 diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc index dca3459d4c1..e8e4d570019 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc @@ -1,6 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// { dg-error "no matching" "" { target *-*-* } 1210 } +// { dg-error "no matching" "" { target *-*-* } 1211 } // Copyright (C) 2009, 2010, 2011 Free Software Foundation // diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc index ec9e9c18eb0..0ea7d2b7335 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc @@ -1,6 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// { dg-error "no matching" "" { target *-*-* } 1210 } +// { dg-error "no matching" "" { target *-*-* } 1211 } // Copyright (C) 2009, 2010, 2011 Free Software Foundation // diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc index 59e74eb3921..8d7844cabe4 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc @@ -1,6 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// { dg-error "no matching" "" { target *-*-* } 1210 } +// { dg-error "no matching" "" { target *-*-* } 1211 } // Copyright (C) 2009, 2010, 2011 Free Software Foundation // diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/5.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/5.cc new file mode 100644 index 00000000000..109057c9738 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/explicit_instantiation/5.cc @@ -0,0 +1,29 @@ +// { 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::forward_list>; +template class std::forward_list>; diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc index 38c0c48a5ec..f53082d1aa1 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1498 } +// { dg-error "no matching" "" { target *-*-* } 1499 } #include diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc index 1340dc84d65..f0af9715138 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1454 } +// { dg-error "no matching" "" { target *-*-* } 1455 } #include diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc index 4ac68432a0c..168d592361d 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1454 } +// { dg-error "no matching" "" { target *-*-* } 1455 } #include #include diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc index 1fa2ed6d941..32bfd53e7c1 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc @@ -18,7 +18,7 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1454 } +// { dg-error "no matching" "" { target *-*-* } 1455 } #include diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/5.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/5.cc new file mode 100644 index 00000000000..965eb9ef953 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/5.cc @@ -0,0 +1,27 @@ +// 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::list >; +template class std::list >; diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/5_c++0x.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/5_c++0x.cc new file mode 100644 index 00000000000..83f207c17f2 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/5_c++0x.cc @@ -0,0 +1,29 @@ +// { 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::list>; +template class std::list>; diff --git a/libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/5.cc b/libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/5.cc new file mode 100644 index 00000000000..b4fbfff56e0 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/5.cc @@ -0,0 +1,29 @@ +// 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::map, + __gnu_test::ExplicitConsAlloc >; +template class std::map, + __gnu_test::ExplicitConsAlloc >; diff --git a/libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/5_c++0x.cc b/libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/5_c++0x.cc new file mode 100644 index 00000000000..3f9a7f8d70f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/5_c++0x.cc @@ -0,0 +1,31 @@ +// { 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::map, + __gnu_test::ExplicitConsAlloc>; +template class std::map, + __gnu_test::ExplicitConsAlloc>; diff --git a/libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/5.cc b/libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/5.cc new file mode 100644 index 00000000000..1d49e588069 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/5.cc @@ -0,0 +1,29 @@ +// 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::multimap, + __gnu_test::ExplicitConsAlloc >; +template class std::multimap, + __gnu_test::ExplicitConsAlloc >; diff --git a/libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/5_c++0x.cc b/libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/5_c++0x.cc new file mode 100644 index 00000000000..195f83b2d97 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/5_c++0x.cc @@ -0,0 +1,31 @@ +// { 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::multimap, + __gnu_test::ExplicitConsAlloc>; +template class std::multimap, + __gnu_test::ExplicitConsAlloc>; diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/5.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/5.cc new file mode 100644 index 00000000000..2cb307d470f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/5.cc @@ -0,0 +1,29 @@ +// 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::multiset, + __gnu_test::ExplicitConsAlloc >; +template class std::multiset, + __gnu_test::ExplicitConsAlloc >; diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/5_c++0x.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/5_c++0x.cc new file mode 100644 index 00000000000..2eea2c90db1 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/5_c++0x.cc @@ -0,0 +1,31 @@ +// { 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::multiset, + __gnu_test::ExplicitConsAlloc>; +template class std::multiset, + __gnu_test::ExplicitConsAlloc>; diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/5.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/5.cc new file mode 100644 index 00000000000..32cd69555cd --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/5.cc @@ -0,0 +1,29 @@ +// 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::set, + __gnu_test::ExplicitConsAlloc >; +template class std::set, + __gnu_test::ExplicitConsAlloc >; diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/5_c++0x.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/5_c++0x.cc new file mode 100644 index 00000000000..2e44282a4cb --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/5_c++0x.cc @@ -0,0 +1,31 @@ +// { 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::set, + __gnu_test::ExplicitConsAlloc>; +template class std::set, + __gnu_test::ExplicitConsAlloc>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/5.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/5.cc new file mode 100644 index 00000000000..f2bd46dd0cc --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/explicit_instantiation/5.cc @@ -0,0 +1,31 @@ +// { 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::unordered_map, std::equal_to, + __gnu_test::ExplicitConsAlloc>; +template class std::unordered_map, std::equal_to, + __gnu_test::ExplicitConsAlloc>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/5.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/5.cc new file mode 100644 index 00000000000..b8574b14542 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/5.cc @@ -0,0 +1,33 @@ +// { 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::unordered_multimap, + std::equal_to, + __gnu_test::ExplicitConsAlloc>; +template class std::unordered_multimap, + std::equal_to, + __gnu_test::ExplicitConsAlloc>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/5.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/5.cc new file mode 100644 index 00000000000..20c6e964793 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/5.cc @@ -0,0 +1,31 @@ +// { 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::unordered_multiset, std::equal_to, + __gnu_test::ExplicitConsAlloc>; +template class std::unordered_multiset, std::equal_to, + __gnu_test::ExplicitConsAlloc>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/5.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/5.cc new file mode 100644 index 00000000000..53ce07008d1 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/explicit_instantiation/5.cc @@ -0,0 +1,31 @@ +// { 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 +// . + +// This file tests explicit instantiation of library containers + +#include +#include + +// { dg-do compile } + +// libstdc++/50118 +template class std::unordered_set, std::equal_to, + __gnu_test::ExplicitConsAlloc>; +template class std::unordered_set, std::equal_to, + __gnu_test::ExplicitConsAlloc>; diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h index 5ef5cdbffb9..279c42d1a30 100644 --- a/libstdc++-v3/testsuite/util/testsuite_allocator.h +++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h @@ -434,6 +434,20 @@ namespace __gnu_test #endif + template + struct ExplicitConsAlloc : std::allocator + { + ExplicitConsAlloc() { } + + template + explicit + ExplicitConsAlloc(const ExplicitConsAlloc&) { } + + template + struct rebind + { typedef ExplicitConsAlloc other; }; + }; + } // namespace __gnu_test #endif // _GLIBCXX_TESTSUITE_ALLOCATOR_H