[v3 PATCH] LWG 2766, LWG 2749

Jonathan Wakely jwakely@redhat.com
Thu Dec 8 13:25:00 GMT 2016


On 26/11/16 14:47 +0200, Ville Voutilainen wrote:
>--- a/libstdc++-v3/include/std/array
>+++ b/libstdc++-v3/include/std/array
>@@ -287,6 +287,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
>     swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)
>     noexcept(noexcept(__one.swap(__two)))
>     { __one.swap(__two); }
>+#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;
>+#endif
>
>   template<std::size_t _Int, typename _Tp, std::size_t _Nm>
>     constexpr _Tp&

We need to also delete std::swap for the debug mode version of
array<T, N>.

I'm removing the 'inline' keyword on these deleted overloads, because
it doesn't do anything.

	* 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.

Tested powerpc64le-linux, committed to trunk.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 7756 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20161208/9ea2e669/attachment.bin>


More information about the Libstdc++ mailing list