Hi,
thanks to Jason's work on DR 1402, fixing in mainline and branch this
library/ABI issue is now trivial. Tested x86_64-linux.
Thanks,
Paolo.
/////////////////////
2012-07-13 Paolo Carlini <paolo.carl...@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.
Index: include/debug/unordered_map
===================================================================
--- include/debug/unordered_map (revision 189442)
+++ include/debug/unordered_map (working copy)
@@ -248,8 +248,8 @@
}
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 @@
}
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 @@
}
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 @@
}
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: include/debug/map.h
===================================================================
--- include/debug/map.h (revision 189442)
+++ include/debug/map.h (working copy)
@@ -213,8 +213,8 @@
#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 @@
#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: include/debug/multimap.h
===================================================================
--- include/debug/multimap.h (revision 189442)
+++ include/debug/multimap.h (working copy)
@@ -201,8 +201,8 @@
#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 @@
#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: include/profile/unordered_map
===================================================================
--- include/profile/unordered_map (revision 189440)
+++ include/profile/unordered_map (working copy)
@@ -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 @@
}
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 @@
}
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 @@
}
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 @@
}
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)
{
Index: include/profile/map.h
===================================================================
--- include/profile/map.h (revision 189440)
+++ include/profile/map.h (working copy)
@@ -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 @@
#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 @@
#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: include/profile/multimap.h
===================================================================
--- include/profile/multimap.h (revision 189440)
+++ include/profile/multimap.h (working copy)
@@ -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 @@
#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 @@
#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: include/bits/stl_map.h
===================================================================
--- include/bits/stl_map.h (revision 189440)
+++ include/bits/stl_map.h (working copy)
@@ -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 @@
#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 @@
#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: include/bits/hashtable_policy.h
===================================================================
--- include/bits/hashtable_policy.h (revision 189440)
+++ include/bits/hashtable_policy.h (working copy)
@@ -831,15 +831,15 @@
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 @@
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: include/bits/stl_multimap.h
===================================================================
--- include/bits/stl_multimap.h (revision 189440)
+++ include/bits/stl_multimap.h (working copy)
@@ -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 @@
#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 @@
#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: include/bits/stl_pair.h
===================================================================
--- include/bits/stl_pair.h (revision 189440)
+++ include/bits/stl_pair.h (working copy)
@@ -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,14 +122,8 @@
: first(__p.first), second(__p.second) { }
constexpr pair(const pair&) = default;
+ constexpr pair(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)) { }
-
// DR 811.
template<class _U1, class = typename
enable_if<is_convertible<_U1, _T1>::value>::type>