From 1b5dc776ca574e812ddc229ef085e45e32d924bf Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 19 Nov 2012 22:28:00 +0000 Subject: [PATCH] stl_algo.h (reverse_copy): Update comment per DR 2074. * include/bits/stl_algo.h (reverse_copy): Update comment per DR 2074. * include/bits/unordered_map.h: Apply DR 2005 resolution. * doc/xml/manual/status_cxx2011.xml: Update per DR 2048. * include/bits/allocator.h (allocator): Apply DR 2103 resolution. * include/ext/array_allocator.h: Likewise. * include/ext/bitmap_allocator.h: Likewise. * include/ext/malloc_allocator.h: Likewise. * include/ext/mt_allocator.h: Likewise. * include/ext/new_allocator.h: Likewise. * include/ext/pool_allocator.h: Likewise. * include/ext/throw_allocator.h: Likewise. * include/ext/alloc_traits.h (__allocator_always_compares_equal): Add additional specializations. * include/std/functional: Add comment about DR resolution. * include/std/future: Likewise. * include/std/scoped_allocator: Likewise. * include/std/thread: Likewise. * testsuite/20_util/allocator/requirements/typedefs.cc: New. * testsuite/20_util/bind/ref_neg.cc: Adjust dg-error line numbers. From-SVN: r193638 --- libstdc++-v3/ChangeLog | 22 +++++++++ .../doc/xml/manual/status_cxx2011.xml | 5 +- libstdc++-v3/include/bits/allocator.h | 18 +++++++- libstdc++-v3/include/bits/stl_algo.h | 2 +- libstdc++-v3/include/bits/unordered_map.h | 16 +++++-- libstdc++-v3/include/ext/alloc_traits.h | 18 ++++++++ libstdc++-v3/include/ext/array_allocator.h | 12 ++++- libstdc++-v3/include/ext/bitmap_allocator.h | 9 +++- libstdc++-v3/include/ext/malloc_allocator.h | 13 ++++-- libstdc++-v3/include/ext/mt_allocator.h | 12 ++++- libstdc++-v3/include/ext/new_allocator.h | 12 ++++- libstdc++-v3/include/ext/pool_allocator.h | 13 ++++-- libstdc++-v3/include/ext/throw_allocator.h | 6 +++ libstdc++-v3/include/std/functional | 2 + libstdc++-v3/include/std/future | 6 +++ libstdc++-v3/include/std/scoped_allocator | 2 + libstdc++-v3/include/std/thread | 2 + .../allocator/requirements/typedefs.cc | 46 +++++++++++++++++++ .../testsuite/20_util/bind/ref_neg.cc | 8 ++-- 19 files changed, 196 insertions(+), 28 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9c5b23a8d52..9636bd7f47f 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,25 @@ +2012-11-19 Jonathan Wakely + + * include/bits/stl_algo.h (reverse_copy): Update comment per DR 2074. + * include/bits/unordered_map.h: Apply DR 2005 resolution. + * doc/xml/manual/status_cxx2011.xml: Update per DR 2048. + * include/bits/allocator.h (allocator): Apply DR 2103 resolution. + * include/ext/array_allocator.h: Likewise. + * include/ext/bitmap_allocator.h: Likewise. + * include/ext/malloc_allocator.h: Likewise. + * include/ext/mt_allocator.h: Likewise. + * include/ext/new_allocator.h: Likewise. + * include/ext/pool_allocator.h: Likewise. + * include/ext/throw_allocator.h: Likewise. + * include/ext/alloc_traits.h (__allocator_always_compares_equal): Add + additional specializations. + * include/std/functional: Add comment about DR resolution. + * include/std/future: Likewise. + * include/std/scoped_allocator: Likewise. + * include/std/thread: Likewise. + * testsuite/20_util/allocator/requirements/typedefs.cc: New. + * testsuite/20_util/bind/ref_neg.cc: Adjust dg-error line numbers. + 2012-11-19 Jonathan Wakely * include/bits/hashtable.h: Improve comments. diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml index 06c28bf092c..0164b0b756d 100644 --- a/libstdc++-v3/doc/xml/manual/status_cxx2011.xml +++ b/libstdc++-v3/doc/xml/manual/status_cxx2011.xml @@ -738,11 +738,10 @@ particular release. - 20.8.10 Function template mem_fn - Partial - Missing overloads for reference-qualified member functions + Y + 20.8.11 diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index 0989ad88cf0..5ccb4918848 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -1,7 +1,6 @@ // Allocators -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -// 2011, 2012 Free Software Foundation, Inc. +// Copyright (C) 2001-2012 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 @@ -46,6 +45,9 @@ // Define the base class to std::allocator. #include +#if __cplusplus >= 201103L +#include +#endif namespace std _GLIBCXX_VISIBILITY(default) { @@ -77,6 +79,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct rebind { typedef allocator<_Tp1> other; }; + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. std::allocator propagate_on_container_move_assignment + typedef true_type propagate_on_container_move_assignment; +#endif }; /** @@ -103,6 +111,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct rebind { typedef allocator<_Tp1> other; }; +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. std::allocator propagate_on_container_move_assignment + typedef true_type propagate_on_container_move_assignment; +#endif + allocator() throw() { } allocator(const allocator& __a) throw() diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index bd513b3b540..77c75b48d28 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -1486,7 +1486,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * range @p [__result,__result+(__last-__first)) such that the * order of the elements is reversed. For every @c i such that @p * 0<=i<=(__last-__first), @p reverse_copy() performs the - * assignment @p *(__result+(__last-__first)-i) = *(__first+i). + * assignment @p *(__result+(__last-__first)-1-i) = *(__first+i). * The ranges @p [__first,__last) and @p * [__result,__result+(__last-__first)) must not overlap. */ diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h index 973467e3b7d..e2b83db3700 100644 --- a/libstdc++-v3/include/bits/unordered_map.h +++ b/libstdc++-v3/include/bits/unordered_map.h @@ -362,7 +362,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert(const value_type& __x) { return _M_h.insert(__x); } - template + template::value>::type> std::pair insert(_Pair&& __x) { return _M_h.insert(std::move(__x)); } @@ -394,7 +396,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert(const_iterator __hint, const value_type& __x) { return _M_h.insert(__hint, __x); } - template + template::value>::type> iterator insert(const_iterator __hint, _Pair&& __x) { return _M_h.insert(__hint, std::move(__x)); } @@ -1023,7 +1027,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert(const value_type& __x) { return _M_h.insert(__x); } - template + template::value>::type> iterator insert(_Pair&& __x) { return _M_h.insert(std::move(__x)); } @@ -1053,7 +1059,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert(const_iterator __hint, const value_type& __x) { return _M_h.insert(__hint, __x); } - template + template::value>::type> iterator insert(const_iterator __hint, _Pair&& __x) { return _M_h.insert(__hint, std::move(__x)); } diff --git a/libstdc++-v3/include/ext/alloc_traits.h b/libstdc++-v3/include/ext/alloc_traits.h index 3ae04acfbc2..a0834c36c85 100644 --- a/libstdc++-v3/include/ext/alloc_traits.h +++ b/libstdc++-v3/include/ext/alloc_traits.h @@ -73,6 +73,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const bool __allocator_always_compares_equal>::value; + template struct bitmap_allocator; + + template + struct __allocator_always_compares_equal> + { static const bool value = true; }; + + template + const bool __allocator_always_compares_equal>::value; + + template struct malloc_allocator; + + template + struct __allocator_always_compares_equal> + { static const bool value = true; }; + + template + const bool __allocator_always_compares_equal>::value; + template struct mt_allocator; template diff --git a/libstdc++-v3/include/ext/array_allocator.h b/libstdc++-v3/include/ext/array_allocator.h index 47f52b50424..736ae02373e 100644 --- a/libstdc++-v3/include/ext/array_allocator.h +++ b/libstdc++-v3/include/ext/array_allocator.h @@ -1,7 +1,6 @@ // array allocator -*- C++ -*- -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -// Free Software Foundation, Inc. +// Copyright (C) 2004-2012 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 @@ -35,6 +34,9 @@ #include #include #include +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +#include +#endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { @@ -113,6 +115,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef _Tp value_type; typedef _Array array_type; +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. std::allocator propagate_on_container_move_assignment + typedef std::true_type propagate_on_container_move_assignment; +#endif + private: array_type* _M_array; size_type _M_used; diff --git a/libstdc++-v3/include/ext/bitmap_allocator.h b/libstdc++-v3/include/ext/bitmap_allocator.h index 9e815610e7f..eff94059715 100644 --- a/libstdc++-v3/include/ext/bitmap_allocator.h +++ b/libstdc++-v3/include/ext/bitmap_allocator.h @@ -1,7 +1,6 @@ // Bitmap Allocator. -*- C++ -*- -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -// Free Software Foundation, Inc. +// Copyright (C) 2004-2012 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 @@ -703,6 +702,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef bitmap_allocator<_Tp1> other; }; +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. propagate_on_container_move_assignment + typedef std::true_type propagate_on_container_move_assignment; +#endif + private: template struct aligned_size diff --git a/libstdc++-v3/include/ext/malloc_allocator.h b/libstdc++-v3/include/ext/malloc_allocator.h index c1901849288..61805797252 100644 --- a/libstdc++-v3/include/ext/malloc_allocator.h +++ b/libstdc++-v3/include/ext/malloc_allocator.h @@ -1,8 +1,6 @@ // Allocator that wraps "C" malloc -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, -// 2010, 2011 -// Free Software Foundation, Inc. +// Copyright (C) 2001-2012 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 @@ -35,6 +33,9 @@ #include #include #include +#if __cplusplus >= 201103L +#include +#endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { @@ -67,6 +68,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct rebind { typedef malloc_allocator<_Tp1> other; }; +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. propagate_on_container_move_assignment + typedef std::true_type propagate_on_container_move_assignment; +#endif + malloc_allocator() _GLIBCXX_USE_NOEXCEPT { } malloc_allocator(const malloc_allocator&) _GLIBCXX_USE_NOEXCEPT { } diff --git a/libstdc++-v3/include/ext/mt_allocator.h b/libstdc++-v3/include/ext/mt_allocator.h index 1ce695a3f82..5900701be74 100644 --- a/libstdc++-v3/include/ext/mt_allocator.h +++ b/libstdc++-v3/include/ext/mt_allocator.h @@ -1,7 +1,6 @@ // MT-optimized allocator -*- C++ -*- -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -// Free Software Foundation, Inc. +// Copyright (C) 2003-2012 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 @@ -35,6 +34,9 @@ #include #include #include +#if __cplusplus >= 201103L +#include +#endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { @@ -576,6 +578,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef const _Tp& const_reference; typedef _Tp value_type; +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. propagate_on_container_move_assignment + typedef std::true_type propagate_on_container_move_assignment; +#endif + pointer address(reference __x) const _GLIBCXX_NOEXCEPT { return std::__addressof(__x); } diff --git a/libstdc++-v3/include/ext/new_allocator.h b/libstdc++-v3/include/ext/new_allocator.h index 0e8add16f15..4523bb85dbf 100644 --- a/libstdc++-v3/include/ext/new_allocator.h +++ b/libstdc++-v3/include/ext/new_allocator.h @@ -1,7 +1,6 @@ // Allocator that wraps operator new -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009, 2010 -// Free Software Foundation, Inc. +// Copyright (C) 2001-2012 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 @@ -34,6 +33,9 @@ #include #include #include +#if __cplusplus >= 201103L +#include +#endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { @@ -68,6 +70,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct rebind { typedef new_allocator<_Tp1> other; }; +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. propagate_on_container_move_assignment + typedef std::true_type propagate_on_container_move_assignment; +#endif + new_allocator() _GLIBCXX_USE_NOEXCEPT { } new_allocator(const new_allocator&) _GLIBCXX_USE_NOEXCEPT { } diff --git a/libstdc++-v3/include/ext/pool_allocator.h b/libstdc++-v3/include/ext/pool_allocator.h index bb340ab9f5c..2bbbd1e5f94 100644 --- a/libstdc++-v3/include/ext/pool_allocator.h +++ b/libstdc++-v3/include/ext/pool_allocator.h @@ -1,8 +1,6 @@ // Allocators -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, -// 2010, 2011 -// Free Software Foundation, Inc. +// Copyright (C) 2001-2012 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 @@ -51,6 +49,9 @@ #include #include #include +#if __cplusplus >= 201103L +#include +#endif namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { @@ -140,6 +141,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct rebind { typedef __pool_alloc<_Tp1> other; }; +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. propagate_on_container_move_assignment + typedef std::true_type propagate_on_container_move_assignment; +#endif + __pool_alloc() _GLIBCXX_USE_NOEXCEPT { } __pool_alloc(const __pool_alloc&) _GLIBCXX_USE_NOEXCEPT { } diff --git a/libstdc++-v3/include/ext/throw_allocator.h b/libstdc++-v3/include/ext/throw_allocator.h index c525b48b77d..599363e3771 100644 --- a/libstdc++-v3/include/ext/throw_allocator.h +++ b/libstdc++-v3/include/ext/throw_allocator.h @@ -643,6 +643,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef value_type& reference; typedef const value_type& const_reference; +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2103. std::allocator propagate_on_container_move_assignment + typedef std::true_type propagate_on_container_move_assignment; +#endif + private: typedef _Cond condition_type; diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 561359c4779..4d6e6a83161 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -810,6 +810,8 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) _Res _Class::*__pm; }; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2048. Unnecessary mem_fn overloads /** * @brief Returns a function object that forwards to the member * pointer @a pm. diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index dd1a86b4d7b..c24ab77d108 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -1132,6 +1132,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_storage(__future_base::_S_allocate_result(__a)) { } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2095. missing constructors needed for uses-allocator construction template promise(allocator_arg_t, const _Allocator&, promise&& __rhs) : _M_future(std::move(__rhs._M_future)), @@ -1306,6 +1308,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Construction and destruction packaged_task() noexcept { } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2095. missing constructors needed for uses-allocator construction template explicit packaged_task(allocator_arg_t, const _Allocator& __a) noexcept @@ -1318,6 +1322,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_state(std::make_shared<_State_type>(std::forward<_Fn>(__fn))) { } + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2097. packaged_task constructors should be constrained template::__type> explicit diff --git a/libstdc++-v3/include/std/scoped_allocator b/libstdc++-v3/include/std/scoped_allocator index f5041ec724e..48cf033ea02 100644 --- a/libstdc++-v3/include/std/scoped_allocator +++ b/libstdc++-v3/include/std/scoped_allocator @@ -349,6 +349,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION construct(pair<_T1, _T2>* __p, piecewise_construct_t, tuple<_Args1...> __x, tuple<_Args2...> __y) { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2203. wrong argument types for piecewise construction auto& __inner = inner_allocator(); auto __x_use_tag = __use_alloc<_T1, inner_allocator_type, _Args1...>(__inner); diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread index 6a4e85fdcf4..718c192c76d 100644 --- a/libstdc++-v3/include/std/thread +++ b/libstdc++-v3/include/std/thread @@ -120,6 +120,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: thread() noexcept = default; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2097. packaged_task constructors should be constrained thread(thread&) = delete; thread(const thread&) = delete; diff --git a/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc new file mode 100644 index 00000000000..37d5032ad80 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2012 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 +// . + + +#include +#include + +// Check std::allocator for required typedefs. + +using std::is_same; +using std::allocator; + +static_assert( is_same::size_type, std::size_t>::value, + "size_type" ); +static_assert( is_same::difference_type, std::ptrdiff_t>::value, + "difference_type" ); +static_assert( is_same::pointer, int*>::value, + "pointer" ); +static_assert( is_same::const_pointer, const int*>::value, + "const_pointer" ); +static_assert( is_same::reference, int&>::value, + "reference" ); +static_assert( is_same::const_reference, const int&>::value, + "const_reference" ); +static_assert( is_same::value_type, int>::value, + "value_type" ); + +static_assert( allocator::propagate_on_container_move_assignment::value, + "propagate_on_container_move_assignment is true" ); diff --git a/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc b/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc index f5b5a019330..0f1b4cfed48 100644 --- a/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc +++ b/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc @@ -30,10 +30,10 @@ void test01() { const int dummy = 0; std::bind(&inc, _1)(0); // { dg-error "no match" } - // { dg-error "rvalue|const" "" { target *-*-* } 1206 } - // { dg-error "rvalue|const" "" { target *-*-* } 1220 } - // { dg-error "rvalue|const" "" { target *-*-* } 1234 } - // { dg-error "rvalue|const" "" { target *-*-* } 1248 } + // { dg-error "rvalue|const" "" { target *-*-* } 1208 } + // { dg-error "rvalue|const" "" { target *-*-* } 1222 } + // { dg-error "rvalue|const" "" { target *-*-* } 1236 } + // { dg-error "rvalue|const" "" { target *-*-* } 1250 } std::bind(&inc, std::ref(dummy))(); // { dg-error "no match" } }