Patchwork [v3] Use noexcept in char_traits, typeindex, more work on pair and tuple

login
register
mail settings
Submitter Paolo Carlini
Date May 21, 2011, 12:12 a.m.
Message ID <4DD70367.3030506@oracle.com>
Download mbox | patch
Permalink /patch/96675/
State New
Headers show

Comments

Paolo Carlini - May 21, 2011, 12:12 a.m.
Hi,

more or less straightforward work (*), <tuple> bits enabled by Jason' 
fix for c++/49082 (thanks again!). Tested x86_64-linux, committed.

Thanks,
Paolo.

(*) Modulo the long standing issue we have with pair' move constructor 
vs std::map: we can't provide it defaulted per the letter of the FDIS. A 
tricky issue we have yet to fully analyze with Jason and Daniel (and all 
the interested parties). Probably it's time...

///////////////////////
2011-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/char_traits.h: Use noexcept throughout.
	* include/std/typeindex: Likewise.

	* include/std/tuple (_Tuple_impl<>_Tuple_impl(_Tuple_impl&&)): Use
	noexcept; adjust callers.
	* include/bits/stl_pair.h (pair<>::pair(pair<>&&)): Use noexcept.
	* testsuite/20_util/tuple/cons/noexcept_move_construct.cc: New.
	* testsuite/20_util/pair/cons/noexcept_move_construct.cc: Likewise.
	* testsuite/20_util/pair/noexcept_swap.cc: Likewise.
	* testsuite/20_util/pair/noexcept_move_assign.cc: Likewise.
	* testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust dg-warning
	line numbers.

Patch

Index: include/std/tuple
===================================================================
--- include/std/tuple	(revision 173985)
+++ include/std/tuple	(working copy)
@@ -169,6 +169,8 @@ 
       constexpr _Tuple_impl(const _Tuple_impl&) = default;
 
       _Tuple_impl(_Tuple_impl&& __in)
+      noexcept(std::is_nothrow_move_constructible<_Head>::value
+	       && std::is_nothrow_move_constructible<_Inherited>::value)
       : _Inherited(std::move(__in._M_tail())), 
 	_Base(std::forward<_Head>(__in._M_head())) { }
 
@@ -191,8 +193,8 @@ 
 
       _Tuple_impl&
       operator=(_Tuple_impl&& __in)
-      noexcept(is_nothrow_move_assignable<_Head>::value
-	       && is_nothrow_move_assignable<_Inherited>::value)
+      noexcept(std::is_nothrow_move_assignable<_Head>::value
+	       && std::is_nothrow_move_assignable<_Inherited>::value)
       {
 	_M_head() = std::forward<_Head>(__in._M_head());
 	_M_tail() = std::move(__in._M_tail());
@@ -252,10 +254,8 @@ 
 	: _Inherited(std::forward<_UElements>(__elements)...) {	}
 
       constexpr tuple(const tuple&) = default;
+      tuple(tuple&&) = default;
 
-      tuple(tuple&& __in)
-      : _Inherited(static_cast<_Inherited&&>(__in)) { }
-
       template<typename... _UElements, typename = typename
 	       std::enable_if<sizeof...(_UElements)
 			      == sizeof...(_Elements)>::type>
@@ -278,7 +278,7 @@ 
 
       tuple&
       operator=(tuple&& __in)
-      noexcept(is_nothrow_move_assignable<_Inherited>::value)
+      noexcept(std::is_nothrow_move_assignable<_Inherited>::value)
       {
 	static_cast<_Inherited&>(*this) = std::move(__in);
 	return *this;
@@ -337,10 +337,8 @@ 
 	: _Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
 
       constexpr tuple(const tuple&) = default;
+      tuple(tuple&&) = default;
 
-      tuple(tuple&& __in)
-      : _Inherited(static_cast<_Inherited&&>(__in)) { }
-
       template<typename _U1, typename _U2>
         tuple(const tuple<_U1, _U2>& __in)
 	: _Inherited(static_cast<const _Tuple_impl<0, _U1, _U2>&>(__in)) { }
@@ -367,7 +365,7 @@ 
 
       tuple&
       operator=(tuple&& __in)
-      noexcept(is_nothrow_move_assignable<_Inherited>::value)
+      noexcept(std::is_nothrow_move_assignable<_Inherited>::value)
       {
 	static_cast<_Inherited&>(*this) = std::move(__in);
 	return *this;
@@ -434,10 +432,8 @@ 
 	: _Inherited(std::forward<_U1>(__a1)) { }
 
       constexpr tuple(const tuple&) = default;
+      tuple(tuple&&) = default;
 
-      tuple(tuple&& __in)
-      : _Inherited(static_cast<_Inherited&&>(__in)) { }
-
       template<typename _U1>
         tuple(const tuple<_U1>& __in)
 	: _Inherited(static_cast<const _Tuple_impl<0, _U1>&>(__in)) { }
@@ -455,7 +451,7 @@ 
 
       tuple&
       operator=(tuple&& __in)
-      noexcept(is_nothrow_move_assignable<_Inherited>::value)
+      noexcept(std::is_nothrow_move_assignable<_Inherited>::value)
       {
 	static_cast<_Inherited&>(*this) = std::move(__in);
 	return *this;
Index: include/std/typeindex
===================================================================
--- include/std/typeindex	(revision 173985)
+++ include/std/typeindex	(working copy)
@@ -1,6 +1,6 @@ 
 // C++0x typeindex -*- C++ -*-
 
-// Copyright (C) 2010 Free Software Foundation, Inc.
+// Copyright (C) 2010, 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
@@ -48,31 +48,31 @@ 
    */
   struct type_index
   {
-    type_index(const type_info& __rhs)
+    type_index(const type_info& __rhs) noexcept
     : _M_target(&__rhs) { }
 
     bool
-    operator==(const type_index& __rhs) const
+    operator==(const type_index& __rhs) const noexcept
     { return *_M_target == *__rhs._M_target; }
 
     bool
-    operator!=(const type_index& __rhs) const
+    operator!=(const type_index& __rhs) const noexcept
     { return *_M_target != *__rhs._M_target; }
 
     bool
-    operator<(const type_index& __rhs) const
+    operator<(const type_index& __rhs) const noexcept
     { return _M_target->before(*__rhs._M_target); }
 
     bool
-    operator<=(const type_index& __rhs) const
+    operator<=(const type_index& __rhs) const noexcept
     { return !__rhs._M_target->before(*_M_target); }
 
     bool
-    operator>(const type_index& __rhs) const
+    operator>(const type_index& __rhs) const noexcept
     { return __rhs._M_target->before(*_M_target); }
 
     bool
-    operator>=(const type_index& __rhs) const
+    operator>=(const type_index& __rhs) const noexcept
     { return !_M_target->before(*__rhs._M_target); }
 
     size_t
Index: include/bits/stl_pair.h
===================================================================
--- include/bits/stl_pair.h	(revision 173982)
+++ include/bits/stl_pair.h	(working copy)
@@ -112,7 +112,7 @@ 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       constexpr pair(const pair&) = default;
 
-      // Implicit.
+      // Implicit?!? Breaks containers!!!
       // pair(pair&&) = default;
 
       // DR 811.
@@ -134,6 +134,8 @@ 
 
       template<class _U1, class _U2>
 	pair(pair<_U1, _U2>&& __p)
+	noexcept(std::is_nothrow_constructible<_T1, _U1&&>::value
+		 && std::is_nothrow_constructible<_T2, _U2&&>::value)
 	: first(std::forward<_U1>(__p.first)),
 	  second(std::forward<_U2>(__p.second)) { }
 
@@ -153,8 +155,8 @@ 
 
       pair&
       operator=(pair&& __p)
-      noexcept(is_nothrow_move_assignable<_T1>::value
-	       && is_nothrow_move_assignable<_T2>::value)
+      noexcept(std::is_nothrow_move_assignable<_T1>::value
+	       && std::is_nothrow_move_assignable<_T2>::value)
       {
 	first = std::move(__p.first);
 	second = std::move(__p.second);
Index: include/bits/char_traits.h
===================================================================
--- include/bits/char_traits.h	(revision 173982)
+++ include/bits/char_traits.h	(working copy)
@@ -1,7 +1,7 @@ 
 // Character Traits for use by standard string and iostream -*- C++ -*-
 
 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009, 2010
+// 2006, 2007, 2008, 2009, 2010, 2011
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -241,15 +241,15 @@ 
       typedef mbstate_t         state_type;
 
       static void
-      assign(char_type& __c1, const char_type& __c2)
+      assign(char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT
       { __c1 = __c2; }
 
       static _GLIBCXX_CONSTEXPR bool
-      eq(const char_type& __c1, const char_type& __c2)
+      eq(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT
       { return __c1 == __c2; }
 
       static _GLIBCXX_CONSTEXPR bool
-      lt(const char_type& __c1, const char_type& __c2)
+      lt(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT
       { return __c1 < __c2; }
 
       static int
@@ -277,25 +277,25 @@ 
       { return static_cast<char_type*>(__builtin_memset(__s, __a, __n)); }
 
       static _GLIBCXX_CONSTEXPR char_type
-      to_char_type(const int_type& __c)
+      to_char_type(const int_type& __c) _GLIBCXX_NOEXCEPT
       { return static_cast<char_type>(__c); }
 
       // To keep both the byte 0xff and the eof symbol 0xffffffff
       // from ending up as 0xffffffff.
       static _GLIBCXX_CONSTEXPR int_type
-      to_int_type(const char_type& __c)
+      to_int_type(const char_type& __c) _GLIBCXX_NOEXCEPT
       { return static_cast<int_type>(static_cast<unsigned char>(__c)); }
 
       static _GLIBCXX_CONSTEXPR bool
-      eq_int_type(const int_type& __c1, const int_type& __c2)
+      eq_int_type(const int_type& __c1, const int_type& __c2) _GLIBCXX_NOEXCEPT
       { return __c1 == __c2; }
 
       static _GLIBCXX_CONSTEXPR int_type
-      eof()
+      eof() _GLIBCXX_NOEXCEPT
       { return static_cast<int_type>(_GLIBCXX_STDIO_EOF); }
 
       static _GLIBCXX_CONSTEXPR int_type
-      not_eof(const int_type& __c)
+      not_eof(const int_type& __c) _GLIBCXX_NOEXCEPT
       { return (__c == eof()) ? 0 : __c; }
   };
 
@@ -312,15 +312,15 @@ 
       typedef mbstate_t         state_type;
 
       static void
-      assign(char_type& __c1, const char_type& __c2)
+      assign(char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT
       { __c1 = __c2; }
 
       static _GLIBCXX_CONSTEXPR bool
-      eq(const char_type& __c1, const char_type& __c2)
+      eq(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT
       { return __c1 == __c2; }
 
       static _GLIBCXX_CONSTEXPR bool
-      lt(const char_type& __c1, const char_type& __c2)
+      lt(const char_type& __c1, const char_type& __c2) _GLIBCXX_NOEXCEPT
       { return __c1 < __c2; }
 
       static int
@@ -348,23 +348,23 @@ 
       { return wmemset(__s, __a, __n); }
 
       static _GLIBCXX_CONSTEXPR char_type
-      to_char_type(const int_type& __c)
+      to_char_type(const int_type& __c) _GLIBCXX_NOEXCEPT
       { return char_type(__c); }
 
       static _GLIBCXX_CONSTEXPR int_type
-      to_int_type(const char_type& __c)
+      to_int_type(const char_type& __c) _GLIBCXX_NOEXCEPT
       { return int_type(__c); }
 
       static _GLIBCXX_CONSTEXPR bool
-      eq_int_type(const int_type& __c1, const int_type& __c2)
+      eq_int_type(const int_type& __c1, const int_type& __c2) _GLIBCXX_NOEXCEPT
       { return __c1 == __c2; }
 
       static _GLIBCXX_CONSTEXPR int_type
-      eof()
+      eof() _GLIBCXX_NOEXCEPT
       { return static_cast<int_type>(WEOF); }
 
       static _GLIBCXX_CONSTEXPR int_type
-      not_eof(const int_type& __c)
+      not_eof(const int_type& __c) _GLIBCXX_NOEXCEPT
       { return eq_int_type(__c, eof()) ? 0 : __c; }
   };
 #endif //_GLIBCXX_USE_WCHAR_T
@@ -391,15 +391,15 @@ 
       typedef mbstate_t         state_type;
 
       static void
-      assign(char_type& __c1, const char_type& __c2)
+      assign(char_type& __c1, const char_type& __c2) noexcept
       { __c1 = __c2; }
 
-      static _GLIBCXX_CONSTEXPR bool
-      eq(const char_type& __c1, const char_type& __c2)
+      static constexpr bool
+      eq(const char_type& __c1, const char_type& __c2) noexcept
       { return __c1 == __c2; }
 
-      static _GLIBCXX_CONSTEXPR bool
-      lt(const char_type& __c1, const char_type& __c2)
+      static constexpr bool
+      lt(const char_type& __c1, const char_type& __c2) noexcept
       { return __c1 < __c2; }
 
       static int
@@ -453,24 +453,24 @@ 
 	return __s;
       }
 
-      static _GLIBCXX_CONSTEXPR char_type
-      to_char_type(const int_type& __c)
+      static constexpr char_type
+      to_char_type(const int_type& __c) noexcept
       { return char_type(__c); }
 
-      static _GLIBCXX_CONSTEXPR int_type
-      to_int_type(const char_type& __c)
+      static constexpr int_type
+      to_int_type(const char_type& __c) noexcept
       { return int_type(__c); }
 
-      static _GLIBCXX_CONSTEXPR bool
-      eq_int_type(const int_type& __c1, const int_type& __c2)
+      static constexpr bool
+      eq_int_type(const int_type& __c1, const int_type& __c2) noexcept
       { return __c1 == __c2; }
 
-      static _GLIBCXX_CONSTEXPR int_type
-      eof()
+      static constexpr int_type
+      eof() noexcept
       { return static_cast<int_type>(-1); }
 
-      static _GLIBCXX_CONSTEXPR int_type
-      not_eof(const int_type& __c)
+      static constexpr int_type
+      not_eof(const int_type& __c) noexcept
       { return eq_int_type(__c, eof()) ? 0 : __c; }
     };
 
@@ -484,15 +484,15 @@ 
       typedef mbstate_t         state_type;
 
       static void
-      assign(char_type& __c1, const char_type& __c2)
+      assign(char_type& __c1, const char_type& __c2) noexcept
       { __c1 = __c2; }
 
-      static _GLIBCXX_CONSTEXPR bool
-      eq(const char_type& __c1, const char_type& __c2)
+      static constexpr bool
+      eq(const char_type& __c1, const char_type& __c2) noexcept
       { return __c1 == __c2; }
 
-      static _GLIBCXX_CONSTEXPR bool
-      lt(const char_type& __c1, const char_type& __c2)
+      static constexpr bool
+      lt(const char_type& __c1, const char_type& __c2) noexcept
       { return __c1 < __c2; }
 
       static int
@@ -546,24 +546,24 @@ 
 	return __s;
       }
 
-      static _GLIBCXX_CONSTEXPR char_type
-      to_char_type(const int_type& __c)
+      static constexpr char_type
+      to_char_type(const int_type& __c) noexcept
       { return char_type(__c); }
 
-      static _GLIBCXX_CONSTEXPR int_type
-      to_int_type(const char_type& __c)
+      static constexpr int_type
+      to_int_type(const char_type& __c) noexcept
       { return int_type(__c); }
 
-      static _GLIBCXX_CONSTEXPR bool
-      eq_int_type(const int_type& __c1, const int_type& __c2)
+      static constexpr bool
+      eq_int_type(const int_type& __c1, const int_type& __c2) noexcept
       { return __c1 == __c2; }
 
-      static _GLIBCXX_CONSTEXPR int_type
-      eof()
+      static constexpr int_type
+      eof() noexcept
       { return static_cast<int_type>(-1); }
 
-      static _GLIBCXX_CONSTEXPR int_type
-      not_eof(const int_type& __c)
+      static constexpr int_type
+      not_eof(const int_type& __c) noexcept
       { return eq_int_type(__c, eof()) ? 0 : __c; }
     };
 
Index: testsuite/20_util/tuple/cons/noexcept_move_construct.cc
===================================================================
--- testsuite/20_util/tuple/cons/noexcept_move_construct.cc	(revision 0)
+++ testsuite/20_util/tuple/cons/noexcept_move_construct.cc	(revision 0)
@@ -0,0 +1,59 @@ 
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2011-05-20  Paolo Carlini  <paolo.carlini@oracle.com>
+//
+// 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
+// <http://www.gnu.org/licenses/>.
+
+#include <tuple>
+#include <testsuite_tr1.h>
+
+using namespace __gnu_test;
+
+typedef std::tuple<int>                                      tt1;
+typedef std::tuple<int, double>                              tt2;
+typedef std::tuple<short, double, int>                       tt3;
+typedef std::tuple<short, NoexceptMoveConsClass, double>     tt4;
+typedef std::tuple<NoexceptMoveConsClass,
+		   NoexceptMoveConsClass, double>            tt5;
+typedef std::tuple<NoexceptMoveConsClass,
+		   NoexceptMoveConsClass,
+		   NoexceptMoveConsClass>                    tt6;
+typedef std::tuple<ExceptMoveConsClass>                      tt7;
+typedef std::tuple<ExceptMoveConsClass, double>              tt8;
+typedef std::tuple<short, double, ExceptMoveConsClass>       tt9;
+typedef std::tuple<ExceptMoveConsClass, double,
+		   ExceptMoveConsClass>                      tt10;
+typedef std::tuple<NoexceptMoveConsClass,
+		   ExceptMoveConsClass>                      tt11;
+typedef std::tuple<int,
+		   NoexceptMoveConsClass,
+		   ExceptMoveConsClass>                      tt12;
+
+static_assert(std::is_nothrow_move_constructible<tt1>::value, "Error");
+static_assert(std::is_nothrow_move_constructible<tt2>::value, "Error");
+static_assert(std::is_nothrow_move_constructible<tt3>::value, "Error");
+static_assert(std::is_nothrow_move_constructible<tt4>::value, "Error");
+static_assert(std::is_nothrow_move_constructible<tt5>::value, "Error");
+static_assert(std::is_nothrow_move_constructible<tt6>::value, "Error");
+static_assert(!std::is_nothrow_move_constructible<tt7>::value, "Error");
+static_assert(!std::is_nothrow_move_constructible<tt8>::value, "Error");
+static_assert(!std::is_nothrow_move_constructible<tt9>::value, "Error");
+static_assert(!std::is_nothrow_move_constructible<tt10>::value, "Error");
+static_assert(!std::is_nothrow_move_constructible<tt11>::value, "Error");
+static_assert(!std::is_nothrow_move_constructible<tt12>::value, "Error");
Index: testsuite/20_util/pair/cons/noexcept_move_construct.cc
===================================================================
--- testsuite/20_util/pair/cons/noexcept_move_construct.cc	(revision 0)
+++ testsuite/20_util/pair/cons/noexcept_move_construct.cc	(revision 0)
@@ -0,0 +1,42 @@ 
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2011-05-20  Paolo Carlini  <paolo.carlini@oracle.com>
+//
+// 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
+// <http://www.gnu.org/licenses/>.
+
+#include <utility>
+#include <testsuite_tr1.h>
+
+using namespace __gnu_test;
+
+typedef std::pair<int, int>                                 tt1;
+typedef std::pair<int, double>                              tt2;
+typedef std::pair<NoexceptMoveConsClass,
+		  NoexceptMoveConsClass>                    tt3;
+typedef std::pair<ExceptMoveConsClass, ExceptMoveConsClass> tt4;
+typedef std::pair<ExceptMoveConsClass, double>              tt5;
+typedef std::pair<NoexceptMoveConsClass,
+		  ExceptMoveConsClass>                      tt6;
+
+static_assert(std::is_nothrow_move_constructible<tt1>::value, "Error");
+static_assert(std::is_nothrow_move_constructible<tt2>::value, "Error");
+static_assert(std::is_nothrow_move_constructible<tt3>::value, "Error");
+static_assert(!std::is_nothrow_move_constructible<tt4>::value, "Error");
+static_assert(!std::is_nothrow_move_constructible<tt5>::value, "Error");
+static_assert(!std::is_nothrow_move_constructible<tt6>::value, "Error");
Index: testsuite/20_util/pair/noexcept_swap.cc
===================================================================
--- testsuite/20_util/pair/noexcept_swap.cc	(revision 0)
+++ testsuite/20_util/pair/noexcept_swap.cc	(revision 0)
@@ -0,0 +1,81 @@ 
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2011-05-20  Paolo Carlini  <paolo.carlini@oracle.com>
+//
+// 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
+// <http://www.gnu.org/licenses/>.
+
+#include <utility>
+#include <testsuite_tr1.h>
+
+using namespace __gnu_test;
+
+typedef std::pair<int, int>                                   tt1;
+typedef std::pair<int, double>                                tt2;
+typedef std::pair<short, NoexceptMoveAssignClass>             tt4;
+typedef std::pair<ExceptMoveAssignClass, double>              tt6;
+typedef std::pair<int, ExceptMoveConsClass>                   tt9;
+typedef std::pair<ExceptMoveAssignClass, short>               tt10;
+typedef std::pair<short, NoexceptMoveConsClass>               tt11;
+typedef std::pair<NoexceptMoveConsClass,
+		  NoexceptMoveConsClass>                      tt12;
+typedef std::pair<NoexceptMoveConsNoexceptMoveAssignClass,
+		  NoexceptMoveConsNoexceptMoveAssignClass>    tt13;
+typedef std::pair<ExceptMoveConsNoexceptMoveAssignClass,
+		  ExceptMoveConsNoexceptMoveAssignClass>      tt14;
+typedef std::pair<NoexceptMoveConsExceptMoveAssignClass,
+		  NoexceptMoveConsExceptMoveAssignClass>      tt15;
+typedef std::pair<ExceptMoveConsExceptMoveAssignClass,
+		  ExceptMoveConsExceptMoveAssignClass>        tt16;
+typedef std::pair<NoexceptMoveConsNoexceptMoveAssignClass,
+		  double>                                     tt17;
+typedef std::pair<NoexceptMoveConsNoexceptMoveAssignClass,
+		  NoexceptMoveConsNoexceptMoveAssignClass>    tt19;
+typedef std::pair<NoexceptMoveConsNoexceptMoveAssignClass,
+		  ExceptMoveConsNoexceptMoveAssignClass>      tt21;
+
+static_assert(noexcept(std::declval<tt1&>().swap(std::declval<tt1&>())),
+	      "Error");
+static_assert(noexcept(std::declval<tt2&>().swap(std::declval<tt2&>())),
+	      "Error");
+static_assert(noexcept(std::declval<tt4&>().swap(std::declval<tt4&>())),
+	      "Error");
+static_assert(!noexcept(std::declval<tt6&>().swap(std::declval<tt6&>())),
+	      "Error");
+static_assert(!noexcept(std::declval<tt9&>().swap(std::declval<tt9&>())),
+	      "Error");
+static_assert(!noexcept(std::declval<tt10&>().swap(std::declval<tt10&>())),
+	      "Error");
+static_assert(noexcept(std::declval<tt11&>().swap(std::declval<tt11&>())),
+	      "Error");
+static_assert(noexcept(std::declval<tt12&>().swap(std::declval<tt12&>())),
+	      "Error");
+static_assert(noexcept(std::declval<tt13&>().swap(std::declval<tt13&>())),
+	      "Error");
+static_assert(!noexcept(std::declval<tt14&>().swap(std::declval<tt14&>())),
+	      "Error");
+static_assert(!noexcept(std::declval<tt15&>().swap(std::declval<tt15&>())),
+	      "Error");
+static_assert(!noexcept(std::declval<tt16&>().swap(std::declval<tt16&>())),
+	      "Error");
+static_assert(noexcept(std::declval<tt17&>().swap(std::declval<tt17&>())),
+	      "Error");
+static_assert(noexcept(std::declval<tt19&>().swap(std::declval<tt19&>())),
+	      "Error");
+static_assert(!noexcept(std::declval<tt21&>().swap(std::declval<tt21&>())),
+	      "Error");
Index: testsuite/20_util/pair/noexcept_move_assign.cc
===================================================================
--- testsuite/20_util/pair/noexcept_move_assign.cc	(revision 0)
+++ testsuite/20_util/pair/noexcept_move_assign.cc	(revision 0)
@@ -0,0 +1,42 @@ 
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2011-05-20  Paolo Carlini  <paolo.carlini@oracle.com>
+//
+// 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
+// <http://www.gnu.org/licenses/>.
+
+#include <utility>
+#include <testsuite_tr1.h>
+
+using namespace __gnu_test;
+
+typedef std::pair<int, int>                                     tt1;
+typedef std::pair<int, double>                                  tt2;
+typedef std::pair<NoexceptMoveAssignClass,
+		  NoexceptMoveAssignClass>                      tt3;
+typedef std::pair<ExceptMoveAssignClass, ExceptMoveAssignClass> tt4;
+typedef std::pair<ExceptMoveAssignClass, double>                tt5;
+typedef std::pair<NoexceptMoveAssignClass,
+		  ExceptMoveAssignClass>                        tt6;
+
+static_assert(std::is_nothrow_move_assignable<tt1>::value, "Error");
+static_assert(std::is_nothrow_move_assignable<tt2>::value, "Error");
+static_assert(std::is_nothrow_move_assignable<tt3>::value, "Error");
+static_assert(!std::is_nothrow_move_assignable<tt4>::value, "Error");
+static_assert(!std::is_nothrow_move_assignable<tt5>::value, "Error");
+static_assert(!std::is_nothrow_move_assignable<tt6>::value, "Error");
Index: testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
===================================================================
--- testsuite/20_util/weak_ptr/comparison/cmp_neg.cc	(revision 173982)
+++ testsuite/20_util/weak_ptr/comparison/cmp_neg.cc	(working copy)
@@ -51,9 +51,9 @@ 
 // { dg-warning "note" "" { target *-*-* } 485 }
 // { dg-warning "note" "" { target *-*-* } 479 }
 // { dg-warning "note" "" { target *-*-* } 469 }
-// { dg-warning "note" "" { target *-*-* } 637 }
+// { dg-warning "note" "" { target *-*-* } 633 }
 // { dg-warning "note" "" { target *-*-* } 1056 }
 // { dg-warning "note" "" { target *-*-* } 1050 }
 // { dg-warning "note" "" { target *-*-* } 342 }
 // { dg-warning "note" "" { target *-*-* } 292 }
-// { dg-warning "note" "" { target *-*-* } 212 }
+// { dg-warning "note" "" { target *-*-* } 214 }