re PR libstdc++/53657 ([C++11] pair(pair&&) move constructor is non-trivial)

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.h (_Hashtable<>::insert(_Pair&&),
	_Hashtable<>::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: r189457
This commit is contained in:
Paolo Carlini 2012-07-13 09:00:18 +00:00 committed by Paolo Carlini
parent dcd1cf087d
commit 2ea4713db5
11 changed files with 70 additions and 57 deletions

View 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-07 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/53578

View File

@ -550,8 +550,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Pair, typename = typename
std::enable_if<__and_<integral_constant<bool, !__constant_iterators>,
std::is_convertible<_Pair,
value_type>>::value>::type>
std::is_constructible<value_type,
_Pair&&>>::value>::type>
_Insert_Return_Type
insert(_Pair&& __v)
{ return _M_insert(std::forward<_Pair>(__v),
@ -559,8 +559,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Pair, typename = typename
std::enable_if<__and_<integral_constant<bool, !__constant_iterators>,
std::is_convertible<_Pair,
value_type>>::value>::type>
std::is_constructible<value_type,
_Pair&&>>::value>::type>
iterator
insert(const_iterator, _Pair&& __v)
{ return _Insert_Conv_Type()(insert(std::forward<_Pair>(__v))); }

View 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
@ -524,8 +524,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)); }
@ -577,8 +577,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,

View 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
@ -445,8 +445,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)); }
@ -482,8 +482,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,

View 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
@ -117,13 +117,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

View File

@ -212,8 +212,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)
{
@ -243,8 +243,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)
{

View File

@ -200,8 +200,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); }
@ -226,8 +226,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)
{

View File

@ -247,8 +247,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)
{
@ -260,8 +260,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)
{
@ -661,8 +661,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)
{
@ -673,8 +673,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)
{

View 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)
{

View 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,

View 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)
{