From patchwork Mon Dec 9 15:19:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 2020137 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RUThE5yG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Y6QZH0cbTz1yQl for ; Tue, 10 Dec 2024 02:21:43 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7CA123858D34 for ; Mon, 9 Dec 2024 15:21:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7CA123858D34 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RUThE5yG X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 642F1385842C for ; Mon, 9 Dec 2024 15:19:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 642F1385842C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 642F1385842C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733757598; cv=none; b=gWoDpQYeKIgioRdlxIhQy4BfLHJaA7psdLnz51siNYVE2eGcKEedHgpbJFLtFgPOchprTBNIiWoeNTnbiyIkNtDczUXaP+0mhbpeu724AqCVYbltrPZ/j1hBTy+mmDcaDdni7qayODOubrXxH3JZRDU+2xWB4XNOrHQp16jOFTw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733757598; c=relaxed/simple; bh=FE/EENlDOo8OvLXuBo5TEr114vKhAxSnWllg9NR9zJg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=lClupvd2jCLGejlAykfG54BnHLMH65QhJWXO2KRJKPW2/sXp3WDyTvpJzUGlIiVSzc2u/KBRJEyijKZM7ToZHtzv8lMZLDOz+E1Dsxc6L0TtjXCI3J3iP2PfDI20DUguUDMo/WGOj8Ue4t7bCJ0TGZIfLfGupR/mpmb4neYHfqk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 642F1385842C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733757598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Dhzz0As92lF4FkbtqeNi6cZmiZDlW4PLt9q5HqZaKN0=; b=RUThE5yGLcazs3aXBHY0khbDtMhWNZ6qpVgAWO/xUvj2Szrcts0EVKL69cTBPvwuSbw2Sf 3LVwK7RL8a6UY8q9FWw7C8TKvXAVPSztDHugK5iISZhypIy4uxgl7PZ8DNV0blzw7UkKVa 8FAJQkIHLrdLSqgCFvCM1hkaVO2/D9Y= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-quFsyvXxNCGXc53ERR1R4A-1; Mon, 09 Dec 2024 10:19:56 -0500 X-MC-Unique: quFsyvXxNCGXc53ERR1R4A-1 X-Mimecast-MFC-AGG-ID: quFsyvXxNCGXc53ERR1R4A Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A9A2E191FCE8; Mon, 9 Dec 2024 15:19:28 +0000 (UTC) Received: from localhost (unknown [10.42.28.9]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 632551955F41; Mon, 9 Dec 2024 15:19:26 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Remove std::allocator::is_always_equal typedef for C++26 Date: Mon, 9 Dec 2024 15:19:15 +0000 Message-ID: <20241209151925.1842398-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 2FACgs_8t2zFW2A6BTsZeU2amJi2lhKFR8JgETrBldM_1733757596 X-Mimecast-Originator: redhat.com X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org This was removed by P2868R3, voted into the C++26 draft at the November 2023 meeting in Kona. We've had a deprecated warning in place for three years. libstdc++-v3/ChangeLog: * include/bits/allocator.h (allocator::is_always_equal): Do not define for C++26. (allocator::is_always_equal): Likewise. * testsuite/20_util/allocator/requirements/typedefs.cc: Check that is_always_equal is not present in C++26. * testsuite/20_util/allocator/void.cc: Do not require is_always_equal for C++26. * testsuite/23_containers/vector/bool/cons/constexpr.cc: Add missing override of base's is_always_equal. * testsuite/23_containers/vector/cons/constexpr.cc: Likewise. --- Tested x86_64-linux. Pushed to trunk. libstdc++-v3/include/bits/allocator.h | 4 ++++ .../20_util/allocator/requirements/typedefs.cc | 14 +++++++++++--- libstdc++-v3/testsuite/20_util/allocator/void.cc | 4 +++- .../23_containers/vector/bool/cons/constexpr.cc | 4 ++++ .../23_containers/vector/cons/constexpr.cc | 4 ++++ 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index ebb487a3ffe..ce678480571 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -95,9 +95,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // 2103. std::allocator propagate_on_container_move_assignment using propagate_on_container_move_assignment = true_type; +#if __cplusplus <= 202302L using is_always_equal _GLIBCXX20_DEPRECATED_SUGGEST("std::allocator_traits::is_always_equal") = true_type; +#endif #if __cplusplus >= 202002L // As noted above, these members are present for C++20 to provide the @@ -152,9 +154,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // 2103. std::allocator propagate_on_container_move_assignment using propagate_on_container_move_assignment = true_type; +#if __cplusplus <= 202302L using is_always_equal _GLIBCXX20_DEPRECATED_SUGGEST("std::allocator_traits::is_always_equal") = true_type; +#endif #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS diff --git a/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc index 49d99e52415..1572f891246 100644 --- a/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc @@ -54,9 +54,13 @@ static_assert( is_same::propagate_on_container_move_assignment, std::true_type>::value, "propagate_on_container_move_assignment" ); -using IAE = allocator::is_always_equal; // { dg-warning "deprecated" "" { target c++20 } } +#if __cplusplus <= 202302L +using IAE = allocator::is_always_equal; // { dg-warning "deprecated" "" { target { c++20_only || c++23_only } } } static_assert( is_same::value, "is_always_equal" ); - +#else +struct B { using is_always_equal = int; }; +struct tester : B, std::allocator { is_always_equal unambig; }; +#endif // Test required typedefs for allocator specialization. static_assert( is_same::value_type, void>::value, @@ -75,6 +79,10 @@ 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 } } +#if __cplusplus <= 202302L +using VIAE = allocator::is_always_equal; // { dg-warning "deprecated" "" { target { c++20_only || c++23_only } } } static_assert( is_same::value, "is_always_equal" ); +#else +struct tester2 : B, std::allocator { is_always_equal unambig; }; +#endif #endif diff --git a/libstdc++-v3/testsuite/20_util/allocator/void.cc b/libstdc++-v3/testsuite/20_util/allocator/void.cc index 04cd2094776..799774861f5 100644 --- a/libstdc++-v3/testsuite/20_util/allocator/void.cc +++ b/libstdc++-v3/testsuite/20_util/allocator/void.cc @@ -36,8 +36,10 @@ test01() static_assert( std::allocator::propagate_on_container_move_assignment(), "POCMA trait should always be present" ); +#if __cplusplus <= 202302L static_assert( std::allocator::is_always_equal(), - "is_always_equal trait should always be present" ); + "is_always_equal trait should be present before C++26" ); +#endif static_assert( std::is_same::size_type, std::size_t>(), diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/cons/constexpr.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/cons/constexpr.cc index 88d99fe682f..fad45e0fb17 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/bool/cons/constexpr.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/cons/constexpr.cc @@ -14,6 +14,10 @@ struct Alloc : std::allocator template constexpr Alloc(const Alloc& a) : personality(a.personality) { } +#if __cplusplus <= 202302L + using is_always_equal = std::false_type; +#endif + int personality = 0; constexpr Alloc select_on_container_copy_construction() const diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/constexpr.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/constexpr.cc index fa78676b300..713223bd6f2 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/cons/constexpr.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/cons/constexpr.cc @@ -22,6 +22,10 @@ struct Alloc : std::allocator template constexpr Alloc(const Alloc& a) : personality(a.personality) { } +#if __cplusplus <= 202302L + using is_always_equal = std::false_type; +#endif + int personality = 0; constexpr Alloc select_on_container_copy_construction() const