From patchwork Thu Dec 8 13:25:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 87258 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp842499qgi; Thu, 8 Dec 2016 05:25:42 -0800 (PST) X-Received: by 10.99.246.5 with SMTP id m5mr132531509pgh.9.1481203541962; Thu, 08 Dec 2016 05:25:41 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id z190si28769938pgd.290.2016.12.08.05.25.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Dec 2016 05:25:41 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-443782-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-443782-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-443782-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=MisG3VGl/3axIJXwx rBKV/SQtLR1z5+r2wXDAY6kG9UhNpQUHjKo5tED8keGAHQxnutG6orVSC57d2Pcc j4ZDnaFGNzKLHFiIaw9oJ6BZLp7PE7L5HLgVXlgUxvctqZnhgOb5duAlpVHMj5sr ANb0XNma2JGReX5PlTN7t2zUZQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=gL1tGeysEaaIudPQxEZp0tE xYlM=; b=gYuSASNmdQIe/iQ4PIFqbskbvYaNdGxl2i0ii/JHnerpipQbTym1rMF JCGYaxg5vvbHo69Dgz/d1Ig3XvHXBhoeQAZZQxVm5gqsjLB+lDNoI8y8uobQoH3s lTeUkTcEjZyeCDBRKUJ8rVUMF1zbf9y+uP1CKyBzlEZxDJPFKSco= Received: (qmail 95146 invoked by alias); 8 Dec 2016 13:25:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 94972 invoked by uid 89); 8 Dec 2016 13:25:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=652, 7 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Dec 2016 13:25:03 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 12D1E31B328; Thu, 8 Dec 2016 13:25:02 +0000 (UTC) Received: from localhost (ovpn-116-110.ams2.redhat.com [10.36.116.110]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB8DP1c9032546; Thu, 8 Dec 2016 08:25:01 -0500 Date: Thu, 8 Dec 2016 13:25:00 +0000 From: Jonathan Wakely To: Ville Voutilainen Cc: libstdc++ , "gcc-patches@gcc.gnu.org" Subject: Re: [v3 PATCH] LWG 2766, LWG 2749 Message-ID: <20161208132500.GC6326@redhat.com> References: <20161122133645.GX3145@redhat.com> <20161122150612.GA3145@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.7.1 (2016-10-04) 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 >+ 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 > constexpr _Tp& We need to also delete std::swap for the debug mode version of array. 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. commit e217847dc333862d70cf8376c09c0b96296d6b54 Author: Jonathan Wakely Date: Thu Dec 8 12:03:39 2016 +0000 Delete std::swap for debug mode array * 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. diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h index 981dbeb..01c7134 100644 --- a/libstdc++-v3/include/bits/stl_pair.h +++ b/libstdc++-v3/include/bits/stl_pair.h @@ -481,7 +481,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 template - inline typename enable_if, __is_swappable<_T2>>::value>::type swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h index 03f9bfc..56e6ec0 100644 --- a/libstdc++-v3/include/bits/unique_ptr.h +++ b/libstdc++-v3/include/bits/unique_ptr.h @@ -652,7 +652,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 template - inline typename enable_if::value>::type swap(unique_ptr<_Tp, _Dp>&, unique_ptr<_Tp, _Dp>&) = delete; diff --git a/libstdc++-v3/include/debug/array b/libstdc++-v3/include/debug/array index 48ab2fd..63e6808 100644 --- a/libstdc++-v3/include/debug/array +++ b/libstdc++-v3/include/debug/array @@ -260,6 +260,14 @@ namespace __debug { return !(__one < __two); } // Specialized algorithms. + +#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + template + typename enable_if< + !_GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::_Is_swappable::value>::type + swap(array<_Tp, _Nm>&, array<_Tp, _Nm>&) = delete; +#endif + template inline void swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two) diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array index fa7bac6..f5028c9 100644 --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -290,7 +290,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 template - inline typename enable_if< !_GLIBCXX_STD_C::__array_traits<_Tp, _Nm>::_Is_swappable::value>::type swap(array<_Tp, _Nm>&, array<_Tp, _Nm>&) = delete; diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index 191d64b..3d69e10 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -930,7 +930,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { __lhs.swap(__rhs); } template - inline enable_if_t && is_swappable_v<_Tp>)> + enable_if_t && is_swappable_v<_Tp>)> swap(optional<_Tp>&, optional<_Tp>&) = delete; template diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index fb2fd17..13e0bf8 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -1588,7 +1588,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 template - inline typename enable_if...>::value>::type swap(tuple<_Elements...>&, tuple<_Elements...>&) = delete; #endif diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index dd6109d..822674f 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -865,8 +865,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { __lhs.swap(__rhs); } template - inline enable_if_t..., - is_swappable<_Types>...>::value> + enable_if_t..., + is_swappable<_Types>...>::value> swap(variant<_Types...>&, variant<_Types...>&) = delete; class bad_variant_access : public exception diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc index 6ad09d6..16761d3 100644 --- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc @@ -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 } diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc index 568ec85..69d638b 100644 --- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc @@ -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 } diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc index d5ab406..1f3a5ed 100644 --- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc @@ -22,4 +22,4 @@ typedef std::tuple_element<1, std::array>::type type; -// { dg-error "static assertion failed" "" { target *-*-* } 308 } +// { dg-error "static assertion failed" "" { target *-*-* } 316 } diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc index 32cb10b..016c747 100644 --- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc @@ -22,4 +22,4 @@ typedef std::tuple_element<1, std::array>::type type; -// { dg-error "static assertion failed" "" { target *-*-* } 351 } +// { dg-error "static assertion failed" "" { target *-*-* } 350 }