From patchwork Wed Feb 19 22:13:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1241060 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-519817-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=fKx1rmZs; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=blU1id7p; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48NBnZ0Ywdz9sRN for ; Thu, 20 Feb 2020 09:13:37 +1100 (AEDT) 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:subject:message-id:references:mime-version:in-reply-to :content-type; q=dns; s=default; b=Upt2bB/EhlPyzDlhSN6hvHYDxp1SA HMxjxv8HNdPjTHGodOpLxXodCJEmGB3bmbwES/nP7e27uijT4XvsCeVp61alGyUP vsqrRH/zOQMuqXZ3/PtjfUIx7vmr24c9Xs/AIOcFcEK4Qfq5fxITOCMc+wAkFa4Y x3oE82CndwYU3s= 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:subject:message-id:references:mime-version:in-reply-to :content-type; s=default; bh=i9VwohjdRQnEYfvq2RdmzI4BKl4=; b=fKx 1rmZs99h/4rm6Fdr72o+Qho8iZpbPm8hIpIo18ckzqOJABIopGrBoQxU5OoBfFEm UWmfjfMZnWfD6kP1zKrRg8Gl44sY4TnKqsa20VhGVRM/ax1AvS5FvmzlNLK/Ae9j W33K6Jju1WmqrBiWg33mo1Mcn8X27GrS7V2P36gM= Received: (qmail 79968 invoked by alias); 19 Feb 2020 22:13:29 -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 79947 invoked by uid 89); 19 Feb 2020 22:13:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LOTSOFHASH, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=__box X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-1.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Feb 2020 22:13:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582150404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CymIkNIUGlm4D2LONTBfypK9ET+oFXMfs8bLTtgpKko=; b=blU1id7pcDVnP3/TfW/ELr57MTEE8oS9M4D+AlE7gdWTBqHb+//lxtZ3PS82LRGo5hikVw 3/va+Hr8zQBX6LLBcCb5MoPiVVLLww+ikVyyR46ELeU8GtAp2uTTXoR+XgvQrH71te8PRb Krx3XZ3oPt8tZUMYi/3vkKS75t+SR+I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-181-11w-pfKCNTKMeK7y3kymBw-1; Wed, 19 Feb 2020 17:13:21 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 45853100550E; Wed, 19 Feb 2020 22:13:20 +0000 (UTC) Received: from localhost (unknown [10.33.36.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3BD05C1B0; Wed, 19 Feb 2020 22:13:19 +0000 (UTC) Date: Wed, 19 Feb 2020 22:13:18 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Implement LWG issues 3329, 3331, 3360, 3364, 3385 Message-ID: <20200219221318.GR9441@redhat.com> References: <20200219124722.GM9441@redhat.com> <20200219154516.GO9441@redhat.com> <20200219212247.GQ9441@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200219212247.GQ9441@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline make common_iterator require copyable (LWG 3385) Add default-initializers to views (LWG 3364) Simplify std::three_way_comparable_with (LWG 3360) Simplify std::totally_ordered (LWG 3331) Simplify std::totally_ordered_with (LWG 3329) Tested powerpc64le-linux, committed to master. commit 1b425f3ac516f7250e9f7eac7cd4fe0908ccfa4e Author: Jonathan Wakely Date: Wed Feb 19 21:56:29 2020 +0000 libstdc++: make common_iterator require copyable (LWG 3385) * include/bits/stl_iterator.h (common_iterator): Add copyable requirement (LWG 3385). * testsuite/24_iterators/headers/iterator/synopsis_c++20.cc: Adjust expected declaration. diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ef91b80ef45..7f3f8876957 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,10 @@ 2020-02-19 Jonathan Wakely + * include/bits/stl_iterator.h (common_iterator): Add copyable + requirement (LWG 3385). + * testsuite/24_iterators/headers/iterator/synopsis_c++20.cc: Adjust + expected declaration. + * include/std/ranges (take_while_view, drop_view, drop_while_view) (elements_view:_Iterator): Initialize data members (LWG 3364). diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index fc9d442b475..372df223113 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -1426,7 +1426,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// An iterator/sentinel adaptor for representing a non-common range. template _Sent> - requires (!same_as<_It, _Sent>) + requires (!same_as<_It, _Sent>) && copyable<_It> class common_iterator { template diff --git a/libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis_c++20.cc b/libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis_c++20.cc index 4d8eca31d38..fbe116be2fd 100644 --- a/libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis_c++20.cc +++ b/libstdc++-v3/testsuite/24_iterators/headers/iterator/synopsis_c++20.cc @@ -56,7 +56,7 @@ namespace std template class move_sentinel; template S> - requires (!same_as) + requires (!same_as) && copyable class common_iterator; template commit 7433536b3d864c0d8d5180348690e1c280a3eaf2 Author: Jonathan Wakely Date: Wed Feb 19 22:00:14 2020 +0000 libstdc++: Add default-initializers to views (LWG 3364) * include/std/ranges (take_while_view, drop_view, drop_while_view) (elements_view:_Iterator): Initialize data members (LWG 3364). diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 622c2948eab..ef91b80ef45 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2020-02-19 Jonathan Wakely + * include/std/ranges (take_while_view, drop_view, drop_while_view) + (elements_view:_Iterator): Initialize data members (LWG 3364). + * libsupc++/compare (three_way_comparable): Remove always-false check that should have been removed with weak_equality (P1959R0). (three_way_comparable_with): Likewise. Reorder requirements (LWG 3360). diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index b348ba2cfcb..7a66491f2e4 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -2008,7 +2008,7 @@ namespace views { return __y._M_end == __x || !std::__invoke(*__y._M_pred, *__x); } }; - _Vp _M_base; + _Vp _M_base = _Vp(); __detail::__box<_Pred> _M_pred; public: @@ -2068,8 +2068,8 @@ namespace views class drop_view : public view_interface> { private: - _Vp _M_base; - range_difference_t<_Vp> _M_count; + _Vp _M_base = _Vp(); + range_difference_t<_Vp> _M_count = 0; public: drop_view() = default; @@ -2147,7 +2147,7 @@ namespace views class drop_while_view : public view_interface> { private: - _Vp _M_base; + _Vp _M_base = _Vp(); __detail::__box<_Pred> _M_pred; public: @@ -3179,7 +3179,7 @@ namespace views { using _Base = conditional_t<_Const, const _Vp, _Vp>; - iterator_t<_Base> _M_current; + iterator_t<_Base> _M_current = iterator_t<_Base>(); friend _Iterator; commit 256f67aa078de0e7bf53a0870c2cb87ab90cda09 Author: Jonathan Wakely Date: Wed Feb 19 21:45:59 2020 +0000 libstdc++: Simplify std::three_way_comparable_with (LWG 3360) This also removes a useless condition that was supposed to be removed by the P1959R0 changes, but left in when that was implemented. * libsupc++/compare (three_way_comparable): Remove always-false check that should have been removed with weak_equality (P1959R0). (three_way_comparable_with): Likewise. Reorder requirements (LWG 3360). diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 1711a359256..622c2948eab 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,9 @@ 2020-02-19 Jonathan Wakely + * libsupc++/compare (three_way_comparable): Remove always-false check + that should have been removed with weak_equality (P1959R0). + (three_way_comparable_with): Likewise. Reorder requirements (LWG 3360). + * include/std/concepts (__detail::__partially_ordered_with): Move here from . (totally_ordered, totally_ordered_with): Use __partially_ordered_with diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare index a74ebc845bf..b88b691b9e1 100644 --- a/libstdc++-v3/libsupc++/compare +++ b/libstdc++-v3/libsupc++/compare @@ -417,8 +417,7 @@ namespace std template concept three_way_comparable = __detail::__weakly_eq_cmp_with<_Tp, _Tp> - && (!convertible_to<_Cat, partial_ordering> - || __detail::__partially_ordered_with<_Tp, _Tp>) + && __detail::__partially_ordered_with<_Tp, _Tp> && requires(const remove_reference_t<_Tp>& __a, const remove_reference_t<_Tp>& __b) { { __a <=> __b } -> __detail::__compares_as<_Cat>; @@ -426,16 +425,15 @@ namespace std template concept three_way_comparable_with - = __detail::__weakly_eq_cmp_with<_Tp, _Up> - && (!convertible_to<_Cat, partial_ordering> - || __detail::__partially_ordered_with<_Tp, _Up>) - && three_way_comparable<_Tp, _Cat> + = three_way_comparable<_Tp, _Cat> && three_way_comparable<_Up, _Cat> && common_reference_with&, const remove_reference_t<_Up>&> && three_way_comparable< common_reference_t&, const remove_reference_t<_Up>&>, _Cat> + && __detail::__weakly_eq_cmp_with<_Tp, _Up> + && __detail::__partially_ordered_with<_Tp, _Up> && requires(const remove_reference_t<_Tp>& __t, const remove_reference_t<_Up>& __u) { { __t <=> __u } -> __detail::__compares_as<_Cat>; commit 0294dc5f4eec5a07d70fac48f75c498c3b1a339b Author: Jonathan Wakely Date: Wed Feb 19 21:40:03 2020 +0000 libstdc++: Simplify std::totally_ordered (LWG 3331) * include/std/concepts (__detail::__partially_ordered_with): Move here from . (totally_ordered, totally_ordered_with): Use __partially_ordered_with to simplify definition (LWG 3331). * libsupc++/compare (__detail::__partially_ordered_with): Move to . diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3941bcbe7ba..1711a359256 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,12 @@ 2020-02-19 Jonathan Wakely + * include/std/concepts (__detail::__partially_ordered_with): Move here + from . + (totally_ordered, totally_ordered_with): Use __partially_ordered_with + to simplify definition (LWG 3331). + * libsupc++/compare (__detail::__partially_ordered_with): Move to + . + * include/std/concepts (totally_ordered_with): Remove redundant requirement (LWG 3329). diff --git a/libstdc++-v3/include/std/concepts b/libstdc++-v3/include/std/concepts index be125c636a1..ba232e953ec 100644 --- a/libstdc++-v3/include/std/concepts +++ b/libstdc++-v3/include/std/concepts @@ -297,16 +297,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __detail::__cref<_Up>>> && __detail::__weakly_eq_cmp_with<_Tp, _Up>; + namespace __detail + { + template + concept __partially_ordered_with + = requires(const remove_reference_t<_Tp>& __t, + const remove_reference_t<_Up>& __u) { + { __t < __u } -> __boolean_testable; + { __t > __u } -> __boolean_testable; + { __t <= __u } -> __boolean_testable; + { __t >= __u } -> __boolean_testable; + { __u < __t } -> __boolean_testable; + { __u > __t } -> __boolean_testable; + { __u <= __t } -> __boolean_testable; + { __u >= __t } -> __boolean_testable; + }; + } // namespace __detail + // [concept.totallyordered], concept totally_ordered template concept totally_ordered = equality_comparable<_Tp> - && requires(__detail::__cref<_Tp> __a, __detail::__cref<_Tp> __b) { - { __a < __b } -> __detail::__boolean_testable; - { __a > __b } -> __detail::__boolean_testable; - { __a <= __b } -> __detail::__boolean_testable; - { __a >= __b } -> __detail::__boolean_testable; - }; + && __detail::__partially_ordered_with<_Tp, _Tp>; template concept totally_ordered_with @@ -314,16 +326,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION && equality_comparable_with<_Tp, _Up> && totally_ordered, __detail::__cref<_Up>>> - && requires(__detail::__cref<_Tp> __t, __detail::__cref<_Up> __u) { - { __t < __u } -> __detail::__boolean_testable; - { __t > __u } -> __detail::__boolean_testable; - { __t <= __u } -> __detail::__boolean_testable; - { __t >= __u } -> __detail::__boolean_testable; - { __u < __t } -> __detail::__boolean_testable; - { __u > __t } -> __detail::__boolean_testable; - { __u <= __t } -> __detail::__boolean_testable; - { __u >= __t } -> __detail::__boolean_testable; - }; + && __detail::__partially_ordered_with<_Tp, _Up>; template concept regular = semiregular<_Tp> && equality_comparable<_Tp>; diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare index ba7db316486..a74ebc845bf 100644 --- a/libstdc++-v3/libsupc++/compare +++ b/libstdc++-v3/libsupc++/compare @@ -411,20 +411,6 @@ namespace std template concept __compares_as = same_as, _Cat>; - - template - concept __partially_ordered_with - = requires(const remove_reference_t<_Tp>& __t, - const remove_reference_t<_Up>& __u) { - { __t < __u } -> __boolean_testable; - { __t > __u } -> __boolean_testable; - { __t <= __u } -> __boolean_testable; - { __t >= __u } -> __boolean_testable; - { __u < __t } -> __boolean_testable; - { __u > __t } -> __boolean_testable; - { __u <= __t } -> __boolean_testable; - { __u >= __t } -> __boolean_testable; - }; } // namespace __detail // [cmp.concept], concept three_way_comparable commit 241ed965509ac931e9ae5f331d0294c1ee4ccd89 Author: Jonathan Wakely Date: Wed Feb 19 21:31:06 2020 +0000 libstdc++: Simplify std::totally_ordered_with (LWG 3329) * include/std/concepts (totally_ordered_with): Remove redundant requirement (LWG 3329). diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6e22536680f..3941bcbe7ba 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,8 @@ 2020-02-19 Jonathan Wakely + * include/std/concepts (totally_ordered_with): Remove redundant + requirement (LWG 3329). + * include/std/ranges (__detail::__convertible_to_non_slicing): New helper concept. (__detail::__pair_like_convertible_to): Remove. diff --git a/libstdc++-v3/include/std/concepts b/libstdc++-v3/include/std/concepts index f3db40b798f..be125c636a1 100644 --- a/libstdc++-v3/include/std/concepts +++ b/libstdc++-v3/include/std/concepts @@ -311,10 +311,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template concept totally_ordered_with = totally_ordered<_Tp> && totally_ordered<_Up> - && common_reference_with<__detail::__cref<_Tp>, __detail::__cref<_Up>> + && equality_comparable_with<_Tp, _Up> && totally_ordered, __detail::__cref<_Up>>> - && equality_comparable_with<_Tp, _Up> && requires(__detail::__cref<_Tp> __t, __detail::__cref<_Up> __u) { { __t < __u } -> __detail::__boolean_testable; { __t > __u } -> __detail::__boolean_testable;