From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 25AEB385E00D for ; Wed, 9 Jun 2021 09:33:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 25AEB385E00D 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-38-2Nu4DBM_M_eDj-JZDlYQpQ-1; Wed, 09 Jun 2021 05:33:01 -0400 X-MC-Unique: 2Nu4DBM_M_eDj-JZDlYQpQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DD1AC193578E; Wed, 9 Jun 2021 09:33:00 +0000 (UTC) Received: from localhost (unknown [10.33.37.1]) by smtp.corp.redhat.com (Postfix) with ESMTP id 747CB163FE; Wed, 9 Jun 2021 09:33:00 +0000 (UTC) Date: Wed, 9 Jun 2021 10:32:59 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Add warnings for some C++23 deprecations Message-ID: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="c0OLS+XONqOb2kIv" Content-Disposition: inline X-Spam-Status: No, score=-14.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2021 09:33:05 -0000 --c0OLS+XONqOb2kIv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline LWG 3036 deprecates std::pmr::polymorphic_allocator::destroy in favour of the equivalent member of std::allocator_traits. LWG 3170 deprecates std::allocator::is_always_equal in favour of the equivalent member of std::allocator_traits. This also updates a comment to note that we support the LWG 3541 change (even before the issue was opened). Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/allocator.h (allocator::is_always_equal): Deprecate. * include/bits/iterator_concepts.h (indirectly_readable_traits): Add LWG issue number to comment. * include/std/memory_resource (polymorphic_allocator::release): Deprecate. * testsuite/20_util/allocator/requirements/typedefs.cc: Add dg-warning for deprecation. Also check std::allocator. Tested powerpc64le-linux. Committed to trunk. --c0OLS+XONqOb2kIv Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit 5bfcfe3087eb05b76395c9efbfc1abbf3f9e1a03 Author: Jonathan Wakely Date: Wed Jun 9 10:11:00 2021 libstdc++: Add warnings for some C++23 deprecations LWG 3036 deprecates std::pmr::polymorphic_allocator::destroy in favour of the equivalent member of std::allocator_traits. LWG 3170 deprecates std::allocator::is_always_equal in favour of the equivalent member of std::allocator_traits. This also updates a comment to note that we support the LWG 3541 change (even before the issue was opened). Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/allocator.h (allocator::is_always_equal): Deprecate. * include/bits/iterator_concepts.h (indirectly_readable_traits): Add LWG issue number to comment. * include/std/memory_resource (polymorphic_allocator::release): Deprecate. * testsuite/20_util/allocator/requirements/typedefs.cc: Add dg-warning for deprecation. Also check std::allocator. diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index 73d5d7a25be..396872ffae5 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -89,9 +89,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2103. std::allocator propagate_on_container_move_assignment - typedef true_type propagate_on_container_move_assignment; + using propagate_on_container_move_assignment = true_type; - typedef true_type is_always_equal; + using is_always_equal + _GLIBCXX20_DEPRECATED_SUGGEST("allocator_traits::is_always_equal") + = true_type; #if __cplusplus >= 202002L allocator() = default; @@ -157,9 +159,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 201103L // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2103. std::allocator propagate_on_container_move_assignment - typedef true_type propagate_on_container_move_assignment; + using propagate_on_container_move_assignment = true_type; - typedef true_type is_always_equal; + using is_always_equal + _GLIBCXX20_DEPRECATED_SUGGEST("allocator_traits::is_always_equal") + = true_type; #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS diff --git a/libstdc++-v3/include/bits/iterator_concepts.h b/libstdc++-v3/include/bits/iterator_concepts.h index f4e94a6263b..8723f35c5cb 100644 --- a/libstdc++-v3/include/bits/iterator_concepts.h +++ b/libstdc++-v3/include/bits/iterator_concepts.h @@ -264,8 +264,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : __detail::__cond_value_type { }; - // LWG 3446 doesn't add this, but it's needed for the case where - // value_type and element_type are both present, but not the same type. + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3541. indirectly_readable_traits should be SFINAE-friendly for all types template<__detail::__has_member_value_type _Tp> requires __detail::__has_member_element_type<_Tp> struct indirectly_readable_traits<_Tp> diff --git a/libstdc++-v3/include/std/memory_resource b/libstdc++-v3/include/std/memory_resource index d330da9de5b..df4e806f814 100644 --- a/libstdc++-v3/include/std/memory_resource +++ b/libstdc++-v3/include/std/memory_resource @@ -322,6 +322,7 @@ namespace pmr #endif template + _GLIBCXX20_DEPRECATED_SUGGEST("allocator_traits::destroy") __attribute__((__nonnull__)) void destroy(_Up* __p) diff --git a/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc index ca4714d108f..4f1f46a3465 100644 --- a/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc @@ -53,5 +53,27 @@ static_assert( is_same::propagate_on_container_move_assignment, std::true_type>::value, "propagate_on_container_move_assignment" ); -static_assert( is_same::is_always_equal, std::true_type>::value, - "is_always_equal" ); +using IAE = allocator::is_always_equal; // { dg-warning "deprecated" "" { target c++20 } } +static_assert( is_same::value, "is_always_equal" ); + + +// Test required typedefs for allocator specialization. +static_assert( is_same::value_type, void>::value, + "void value_type" ); +#if __cplusplus <= 201703L +static_assert( is_same::pointer, void*>::value, + "void pointer" ); +static_assert( is_same::const_pointer, const void*>::value, + "void const_pointer" ); +static_assert( is_same::rebind::other, + allocator>::value, + "void rebind::other" ); +#else +// Since C++20 allocator uses the primary template, so has the same types. +static_assert( is_same::propagate_on_container_move_assignment, + std::true_type>::value, + "propagate_on_container_move_assignment" ); + +using VIAE = allocator::is_always_equal; // { dg-warning "deprecated" "" { target c++20 } } +static_assert( is_same::value, "is_always_equal" ); +#endif --c0OLS+XONqOb2kIv--