From patchwork Wed Jun 12 20:32:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1947119 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=GFXaXEeO; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4Vzy0z5y3Kz20Pb for ; Thu, 13 Jun 2024 06:33:23 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 276D33882ADC for ; Wed, 12 Jun 2024 20:33:22 +0000 (GMT) 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 ESMTPS id 277BA388216D for ; Wed, 12 Jun 2024 20:32:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 277BA388216D 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 277BA388216D 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=1718224365; cv=none; b=pXRRSDdv9i3YgD6HXrNS6s85H34WZIm0HhJazKcflTjdJ/esVTySo6GaxTxczvBnpt0v6n6Va3ZTRhW9S/sB7+wBURoyQ4hhmNo0jB7jtHXnOS88QcU4tdv7Jv4hOWwQL4D4uA6sgpFX8D+Za7bpJXu3YMLDMAnzOi2skavV0Ho= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718224365; c=relaxed/simple; bh=b0On8udEofCOPEabVzGGQflFwk6tlglpEarH+nl3ARE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=tXGnXPnDkFPVgK3KkjIyTwA2vKosm+khrntB5cZUaU6gVXr/1E9lVP+0V8NmxRToOnWEAchF3nyaTHCvjEwc3dwh4LFf/DP+tsSTZswakcUCbT6UeSI+iBwv0BGrv+Xnez0gViRWCmUW1PvF3xnpIpV3jrzctLlDX/FZjeEW7yU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718224359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZUiwD8sfjW3Lb48j6L3PdLtzD0GD1z2aec0FPjgb5vY=; b=GFXaXEeO/bVuvaxXxrhmxb16PQ4KrDszFpwbLLuIs3R5+XCll59aH5j3MRlL0a/Mwl56M0 Zl2Appf6e6PVtci87hGv9C6ccDaFCKwsfBM3tb/liEHgxrLA+Inz+BnPsMdjHV/suuMu1Q pzgvKc8OT9jwITOGRquR8Ga0ZylY2hk= Received: from mx-prod-mc-02.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-641-cAULrnkvP7OHWmB87rxRGg-1; Wed, 12 Jun 2024 16:32:37 -0400 X-MC-Unique: cAULrnkvP7OHWmB87rxRGg-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 262DF19560AE; Wed, 12 Jun 2024 20:32:36 +0000 (UTC) Received: from localhost (unknown [10.39.192.128]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 548691955E91; Wed, 12 Jun 2024 20:32:35 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Patrick Palka Subject: [PATCH] libstdc++: Add ranges::range_common_reference_t for C++20 (LWG 3860) Date: Wed, 12 Jun 2024 21:32:20 +0100 Message-ID: <20240612203233.879427-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.8 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_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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 Jason noticed this was missing. Tested x86_64-linux. -- >8 -- LWG 3860 added this alias template. Both libc++ and MSVC treat this as a DR for C++20, so this change does so too. libstdc++-v3/ChangeLog: * include/bits/ranges_base.h (range_common_reference_t): New alias template, as per LWG 3860. * testsuite/std/ranges/range.cc: Check it. --- libstdc++-v3/include/bits/ranges_base.h | 6 ++++++ libstdc++-v3/testsuite/std/ranges/range.cc | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/libstdc++-v3/include/bits/ranges_base.h b/libstdc++-v3/include/bits/ranges_base.h index 23c0b56ff22..63eb552b48b 100644 --- a/libstdc++-v3/include/bits/ranges_base.h +++ b/libstdc++-v3/include/bits/ranges_base.h @@ -537,6 +537,12 @@ namespace ranges using range_rvalue_reference_t = iter_rvalue_reference_t>; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3860. range_common_reference_t is missing + template + using range_common_reference_t + = iter_common_reference_t>; + /// [range.sized] The sized_range concept. template concept sized_range = range<_Tp> diff --git a/libstdc++-v3/testsuite/std/ranges/range.cc b/libstdc++-v3/testsuite/std/ranges/range.cc index 18435659137..760f6ffacfd 100644 --- a/libstdc++-v3/testsuite/std/ranges/range.cc +++ b/libstdc++-v3/testsuite/std/ranges/range.cc @@ -83,3 +83,9 @@ static_assert( same_as, char&&> ); static_assert( same_as, WritableObject> ); + +// LWG 3860. range_common_reference_t is missing +static_assert( same_as, + char&> ); +static_assert( same_as, + char&> );