Delete std::swap for debug mode array
authorJonathan Wakely <jwakely@redhat.com>
Thu, 8 Dec 2016 13:25:03 +0000 (13:25 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 8 Dec 2016 13:25:03 +0000 (13:25 +0000)
* include/debug/array (swap): Add deleted overload.
* include/bits/stl_pair.h (swap): Remove redundant inline keyword
from deleted overload.
* include/bits/unique_ptr.h (swap): Likewise.
* include/std/array (swap): Likewise.
* include/std/optional (swap): Likewise.
* include/std/tuple (swap): Likewise.
* include/std/variant (swap): Likewise.
* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc:
Adjust dg-error line numbers.
* testsuite/23_containers/array/tuple_interface/get_neg.cc: Likewise.
* testsuite/23_containers/array/tuple_interface/
tuple_element_debug_neg.cc: Likewise.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
Likewise.

From-SVN: r243437

12 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_pair.h
libstdc++-v3/include/bits/unique_ptr.h
libstdc++-v3/include/debug/array
libstdc++-v3/include/std/array
libstdc++-v3/include/std/optional
libstdc++-v3/include/std/tuple
libstdc++-v3/include/std/variant
libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc
libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc

index 42b02a072ff1e164e3bd21a7e44021c9c34b2afb..084f0d78a7df0eebb8a91b69530e420d49709604 100644 (file)
@@ -1,5 +1,21 @@
 2016-12-08  Jonathan Wakely  <jwakely@redhat.com>
 
+       * include/debug/array (swap): Add deleted overload.
+       * include/bits/stl_pair.h (swap): Remove redundant inline keyword
+       from deleted overload.
+       * include/bits/unique_ptr.h (swap): Likewise.
+       * include/std/array (swap): Likewise.
+       * include/std/optional (swap): Likewise.
+       * include/std/tuple (swap): Likewise.
+       * include/std/variant (swap): Likewise.
+       * testsuite/23_containers/array/tuple_interface/get_debug_neg.cc:
+       Adjust dg-error line numbers.
+       * testsuite/23_containers/array/tuple_interface/get_neg.cc: Likewise.
+       * testsuite/23_containers/array/tuple_interface/
+       tuple_element_debug_neg.cc: Likewise.
+       * testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
+       Likewise.
+
        PR libstdc++/71856
        * doc/xml/manual/using.xml: Document macro.
        * include/bits/c++config [_GLIBCXX_DEBUG || _GLIBCXX_PARALLEL]
index 981dbeb6875327d15b2d5b9dd43f269cbfe37032..01c71345bb239ba7ca5b3260d408cc3575971b3a 100644 (file)
@@ -481,7 +481,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
   template<typename _T1, typename _T2>
-    inline
     typename enable_if<!__and_<__is_swappable<_T1>,
                               __is_swappable<_T2>>::value>::type
     swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;
index 03f9bfc7d1fa1dd62741a81b15be9684999349d5..56e6ec0b2c77c78477f5157485f28ddff2da38da 100644 (file)
@@ -652,7 +652,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
   template<typename _Tp, typename _Dp>
-    inline
     typename enable_if<!__is_swappable<_Dp>::value>::type
     swap(unique_ptr<_Tp, _Dp>&,
         unique_ptr<_Tp, _Dp>&) = delete;
index 48ab2fdf120e09565a9650d09ab4f1fed821f07e..63e680897dac658375f53acb02c6de919eeb0f62 100644 (file)
@@ -260,6 +260,14 @@ namespace __debug
     { return !(__one < __two); }
 
   // Specialized algorithms.
+
+#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
+  template<typename _Tp, size_t _Nm>
+    typename enable_if<
+      !_GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::_Is_swappable::value>::type
+    swap(array<_Tp, _Nm>&, array<_Tp, _Nm>&) = delete;
+#endif
+
   template<typename _Tp, std::size_t _Nm>
     inline void
     swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
index fa7bac6cfbe819b7fdaa82942003fa5530abb393..f5028c98994a5812c31605abbeeec1730ea785c6 100644 (file)
@@ -290,7 +290,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
   template<typename _Tp, std::size_t _Nm>
-    inline
     typename enable_if<
       !_GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::_Is_swappable::value>::type
     swap(array<_Tp, _Nm>&, array<_Tp, _Nm>&) = delete;
index 191d64ba90254c1f6d3ee1e2912ad006de75d366..3d69e104199d0f6d47bfc5fa5baabcec66968ead 100644 (file)
@@ -930,7 +930,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { __lhs.swap(__rhs); }
 
   template<typename _Tp>
-    inline enable_if_t<!(is_move_constructible_v<_Tp> && is_swappable_v<_Tp>)>
+    enable_if_t<!(is_move_constructible_v<_Tp> && is_swappable_v<_Tp>)>
     swap(optional<_Tp>&, optional<_Tp>&) = delete;
 
   template<typename _Tp>
index fb2fd177aee8ec90ecc5c8ecdef6872a6553de61..13e0bf8e3cf518ed2b1e20adaa514f680fa55643 100644 (file)
@@ -1588,7 +1588,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
   template<typename... _Elements>
-    inline
     typename enable_if<!__and_<__is_swappable<_Elements>...>::value>::type
     swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete;
 #endif
index dd6109dc046862b7de9fba7af839e4d1d08b85eb..822674ffbecf30ed4a85660763aba3fe82db8324 100644 (file)
@@ -865,8 +865,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { __lhs.swap(__rhs); }
 
   template<typename... _Types>
-    inline enable_if_t<!__and_<is_move_constructible<_Types>...,
-                              is_swappable<_Types>...>::value>
+    enable_if_t<!__and_<is_move_constructible<_Types>...,
+                       is_swappable<_Types>...>::value>
     swap(variant<_Types...>&, variant<_Types...>&) = delete;
 
   class bad_variant_access : public exception
index 6ad09d6ac24f2ac4a3a99143232e0eff9e37a030..16761d31aa88f8576d3413b5d8ea29103bab5991 100644 (file)
@@ -27,6 +27,6 @@ int n1 = std::get<1>(a);
 int n2 = std::get<1>(std::move(a));
 int n3 = std::get<1>(ca);
 
-// { dg-error "static assertion failed" "" { target *-*-* } 273 }
-// { dg-error "static assertion failed" "" { target *-*-* } 282 }
+// { dg-error "static assertion failed" "" { target *-*-* } 281 }
 // { dg-error "static assertion failed" "" { target *-*-* } 290 }
+// { dg-error "static assertion failed" "" { target *-*-* } 298 }
index 568ec850a394858c3114fa60f62150852dea2c8b..69d638b7c5ef79fccce624131a5cd989feadb541 100644 (file)
@@ -27,6 +27,6 @@ int n1 = std::get<1>(a);
 int n2 = std::get<1>(std::move(a));
 int n3 = std::get<1>(ca);
 
-// { dg-error "static assertion failed" "" { target *-*-* } 303 }
-// { dg-error "static assertion failed" "" { target *-*-* } 312 }
-// { dg-error "static assertion failed" "" { target *-*-* } 320 }
+// { dg-error "static assertion failed" "" { target *-*-* } 302 }
+// { dg-error "static assertion failed" "" { target *-*-* } 311 }
+// { dg-error "static assertion failed" "" { target *-*-* } 319 }
index d5ab406c3d22246d9412e7bbead15ba243c933fb..1f3a5edc07e3631faefdb7ba5142004ca9eab8a9 100644 (file)
@@ -22,4 +22,4 @@
 
 typedef std::tuple_element<1, std::array<int, 1>>::type type;
 
-// { dg-error "static assertion failed" "" { target *-*-* } 308 }
+// { dg-error "static assertion failed" "" { target *-*-* } 316 }
index 32cb10b7dc21b2651969a427848be0b67e94aee1..016c7478f2110e67bc1e27709eb99543e1868043 100644 (file)
@@ -22,4 +22,4 @@
 
 typedef std::tuple_element<1, std::array<int, 1>>::type type;
 
-// { dg-error "static assertion failed" "" { target *-*-* } 351 }
+// { dg-error "static assertion failed" "" { target *-*-* } 350 }