Patchwork [v3] Remove wa for c++/49045 in std::swap

login
register
mail settings
Submitter Paolo Carlini
Date Aug. 28, 2011, 9:06 p.m.
Message ID <4E5AADEC.3020707@oracle.com>
Download mbox | patch
Permalink /patch/111945/
State New
Headers show

Comments

Paolo Carlini - Aug. 28, 2011, 9:06 p.m.
Hi,

tested x86_64-linux, committed to mainline.

Paolo.

//////////////////////////
2011-08-28  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/move.h (swap(_Tp(&)[_Nm], _Tp(&)[_Nm])): Remove
	workaround for c++/49045.
	* include/bits/algorithmfwd.h: Likewise.

Patch

Index: include/bits/move.h
===================================================================
--- include/bits/move.h	(revision 178146)
+++ include/bits/move.h	(working copy)
@@ -152,21 +152,13 @@ 
       __b = _GLIBCXX_MOVE(__tmp);
     }
 
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-  // To work around c++/49045.
-  template<typename _Tp>
-    struct __is_nothrow_swappable
-    { static const bool value = noexcept(swap(std::declval<_Tp&>(),
-					      std::declval<_Tp&>())); };
-#endif
-
   // _GLIBCXX_RESOLVE_LIB_DEFECTS
   // DR 809. std::swap should be overloaded for array types.
   template<typename _Tp, size_t _Nm>
     inline void
     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
-    noexcept(__is_nothrow_swappable<_Tp>::value)
+    noexcept(noexcept(swap(*__a, *__b)))
 #endif
     {
       for (size_t __n = 0; __n < _Nm; ++__n)
Index: include/bits/algorithmfwd.h
===================================================================
--- include/bits/algorithmfwd.h	(revision 178146)
+++ include/bits/algorithmfwd.h	(working copy)
@@ -558,9 +558,9 @@ 
 
   template<typename _Tp, size_t _Nm>
     void
-    swap(_Tp (&)[_Nm], _Tp (&)[_Nm])
+    swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
-    noexcept(__is_nothrow_swappable<_Tp>::value)
+    noexcept(noexcept(swap(*__a, *__b)))
 #endif
     ;