]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/53657 ([C++11] pair(pair&&) move constructor is non-trivial)
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 13 Jul 2012 08:59:58 +0000 (08:59 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 13 Jul 2012 08:59:58 +0000 (08:59 +0000)
2012-07-13  Paolo Carlini  <paolo.carlini@oracle.com>

PR libstdc++/53657
* include/bits/stl_pair.h (pair<>::pair(pair&&)): Declare defaulted,
per C++11.
* include/bits/stl_map.h (map<>::insert(_Pair&&), map<>::insert
(const_iterator, _Pair&&)): Constrain with std::is_constructible,
per LWG2005.
* include/bits/stl_multimap.h (multimap<>::insert(_Pair&&),
multimap<>::insert(const_iterator, _Pair&&)): Likewise.
* include/bits/hashtable_policy.h (_Insert<>::insert(_Pair&&),
_Insert<>::insert(const_iterator, _Pair&&)): Likewise.
* include/debug/unordered_map: Adjust.
* include/debug/map.h: Likewise.
* include/debug/multimap.h: Likewise.
* include/profile/unordered_map: Likewise.
* include/profile/map.h: Likewise.
* include/profile/multimap.h: Likewise.

From-SVN: r189456

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/hashtable_policy.h
libstdc++-v3/include/bits/stl_map.h
libstdc++-v3/include/bits/stl_multimap.h
libstdc++-v3/include/bits/stl_pair.h
libstdc++-v3/include/debug/map.h
libstdc++-v3/include/debug/multimap.h
libstdc++-v3/include/debug/unordered_map
libstdc++-v3/include/profile/map.h
libstdc++-v3/include/profile/multimap.h
libstdc++-v3/include/profile/unordered_map

index 0eb76a653fc507babfcf73f0d15cfd501e0ad8e5..a19f33c488251dd7a460dcb915c8885210d0dace 100644 (file)
@@ -1,3 +1,22 @@
+2012-07-13  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR libstdc++/53657
+       * include/bits/stl_pair.h (pair<>::pair(pair&&)): Declare defaulted,
+       per C++11.
+       * include/bits/stl_map.h (map<>::insert(_Pair&&), map<>::insert
+       (const_iterator, _Pair&&)): Constrain with std::is_constructible,
+       per LWG2005.
+       * include/bits/stl_multimap.h (multimap<>::insert(_Pair&&),
+       multimap<>::insert(const_iterator, _Pair&&)): Likewise.
+       * include/bits/hashtable_policy.h (_Insert<>::insert(_Pair&&),
+       _Insert<>::insert(const_iterator, _Pair&&)): Likewise.
+       * include/debug/unordered_map: Adjust.
+       * include/debug/map.h: Likewise.
+       * include/debug/multimap.h: Likewise.
+       * include/profile/unordered_map: Likewise.
+       * include/profile/map.h: Likewise.
+       * include/profile/multimap.h: Likewise.
+
 2012-07-06  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR libstdc++/53872
index 27badbcb104d70053ce5ab83aebb647ffac5a9fd..c0a6df5db2370e4fa67f963f29f27328d1261c26 100644 (file)
@@ -831,15 +831,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       using __base_type::insert;
 
       template<typename _Pair>
-       using __is_conv = std::is_convertible<_Pair, value_type>;
+       using __is_cons = std::is_constructible<value_type, _Pair&&>;
 
       template<typename _Pair>
-       using _IFconv = std::enable_if<__is_conv<_Pair>::value>;
+       using _IFcons = std::enable_if<__is_cons<_Pair>::value>;
 
       template<typename _Pair>
-       using _IFconvp = typename _IFconv<_Pair>::type;
+       using _IFconsp = typename _IFcons<_Pair>::type;
 
-      template<typename _Pair, typename = _IFconvp<_Pair>>
+      template<typename _Pair, typename = _IFconsp<_Pair>>
        __ireturn_type
        insert(_Pair&& __v)
        {
@@ -847,7 +847,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
          return __h._M_insert(std::forward<_Pair>(__v), __unique_keys());
        }
 
-      template<typename _Pair, typename = _IFconvp<_Pair>>
+      template<typename _Pair, typename = _IFconsp<_Pair>>
        iterator
        insert(const_iterator, _Pair&& __v)
        { return __iconv_type()(insert(std::forward<_Pair>(__v))); }
index 881f938063d2b26b4cccd87f88454610ee7d3058..cfd478a3b92f145c1f558c7ea1a45fab9305648d 100644 (file)
@@ -1,7 +1,7 @@
 // Map implementation -*- C++ -*-
 
 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-// 2011 Free Software Foundation, Inc.
+// 2011, 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
@@ -530,8 +530,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         std::pair<iterator, bool>
         insert(_Pair&& __x)
         { return _M_t._M_insert_unique(std::forward<_Pair>(__x)); }
@@ -583,8 +583,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         iterator
         insert(const_iterator __position, _Pair&& __x)
         { return _M_t._M_insert_unique_(__position,
index 6c92bcd198eb35a121cc38dee9981b4ea10a757d..6fc478774540c96b4e458eea368020a1c31b76b0 100644 (file)
@@ -1,7 +1,7 @@
 // Multimap implementation -*- C++ -*-
 
 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-// 2011 Free Software Foundation, Inc.
+// 2011, 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
@@ -451,8 +451,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         iterator
         insert(_Pair&& __x)
         { return _M_t._M_insert_equal(std::forward<_Pair>(__x)); }
@@ -488,8 +488,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         iterator
         insert(const_iterator __position, _Pair&& __x)
         { return _M_t._M_insert_equal_(__position,
index 45a1c61fea1a7ba82076192973cfb3172f4d0da3..4ece92aac121ad5ebe25e5255b33e4c0063e3e00 100644 (file)
@@ -1,7 +1,7 @@
 // Pair implementation -*- C++ -*-
 
 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-// 2010, 2011
+// 2010, 2011, 2012
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -122,13 +122,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        : first(__p.first), second(__p.second) { }
 
       constexpr pair(const pair&) = default;
-
-      // XXX Defaulted?!? Breaks std::map!!!
-      pair(pair&& __p)
-      noexcept(__and_<is_nothrow_move_constructible<_T1>,
-                     is_nothrow_move_constructible<_T2>>::value)
-      : first(std::forward<first_type>(__p.first)),
-       second(std::forward<second_type>(__p.second)) { }
+      constexpr pair(pair&&) = default;
 
       // DR 811.
       template<class _U1, class = typename
index 34b83a5cee54a6bc3d7d58b7f94a5d7e3799d740..95871ac6b73ff353ecf17d822a00efa41ff7e731 100644 (file)
@@ -213,8 +213,8 @@ namespace __debug
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         std::pair<iterator, bool>
         insert(_Pair&& __x)
         {
@@ -244,8 +244,8 @@ namespace __debug
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         iterator
         insert(const_iterator __position, _Pair&& __x)
         {
index 9157fa3458a3d56a4a1fc82efd6e97957b10236f..e1e09bc07afe44383ce407aef7a5d12067d15dc7 100644 (file)
@@ -201,8 +201,8 @@ namespace __debug
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         iterator
         insert(_Pair&& __x)
         { return iterator(_Base::insert(std::forward<_Pair>(__x)), this); }
@@ -227,8 +227,8 @@ namespace __debug
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         iterator
         insert(const_iterator __position, _Pair&& __x)
         {
index 222bccf969f286daacefdfb4c1f538e910423a02..96cb148ebb57c38161f08c84d8cf95424d1e861a 100644 (file)
@@ -248,8 +248,8 @@ namespace __debug
       }
 
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
        std::pair<iterator, bool>
        insert(_Pair&& __obj)
        {
@@ -261,8 +261,8 @@ namespace __debug
        }
 
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
        iterator
        insert(const_iterator __hint, _Pair&& __obj)
        {
@@ -663,8 +663,8 @@ namespace __debug
       }
 
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
        iterator
        insert(_Pair&& __obj)
        {
@@ -675,8 +675,8 @@ namespace __debug
        }
 
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
        iterator
        insert(const_iterator __hint, _Pair&& __obj)
        {
index 200da370d73a2c7dadf3ea0f82fdd553bb222b04..42c32aae4ce95d6b35db7fec025545d946ae0d48 100644 (file)
@@ -1,6 +1,6 @@
 // Profiling map implementation -*- C++ -*-
 
-// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011, 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
@@ -248,8 +248,8 @@ namespace __profile
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         std::pair<iterator, bool>
         insert(_Pair&& __x)
         {
@@ -289,8 +289,8 @@ namespace __profile
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         iterator
         insert(const_iterator __position, _Pair&& __x)
         {
index b71be4570bdea575157b06af015226d901b42182..608d6b76c680e0fe71123ed12e7d3ec2f8e9a037 100644 (file)
@@ -1,6 +1,6 @@
 // Profiling multimap implementation -*- C++ -*-
 
-// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011, 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
@@ -186,8 +186,8 @@ namespace __profile
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         iterator
         insert(_Pair&& __x)
         { return iterator(_Base::insert(std::forward<_Pair>(__x))); }
@@ -209,8 +209,8 @@ namespace __profile
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         iterator
         insert(const_iterator __position, _Pair&& __x)
         { return iterator(_Base::insert(__position,
index 36f34e0a1053883f9b329e6cdda5ec2b2ef44919..266e804fe361325a7ea769be3c01ee651093695d 100644 (file)
@@ -1,6 +1,6 @@
 // Profiling unordered_map/unordered_multimap implementation -*- C++ -*-
 
-// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011, 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
@@ -214,8 +214,8 @@ namespace __profile
       }
 
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         std::pair<iterator, bool>
         insert(_Pair&& __obj)
         {
@@ -227,8 +227,8 @@ namespace __profile
        }
 
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         iterator
         insert(const_iterator __iter, _Pair&& __v)
         { 
@@ -503,8 +503,8 @@ namespace __profile
       }
 
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         iterator
         insert(_Pair&& __obj)
         {
@@ -515,8 +515,8 @@ namespace __profile
        }
 
       template<typename _Pair, typename = typename
-              std::enable_if<std::is_convertible<_Pair,
-                                                 value_type>::value>::type>
+              std::enable_if<std::is_constructible<value_type,
+                                                   _Pair&&>::value>::type>
         iterator
         insert(const_iterator __iter, _Pair&& __v)
         {