Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2227911/?format=api
{ "id": 2227911, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2227911/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260424132901.1896897-1-tkaminsk@redhat.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.1/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null }, "msgid": "<20260424132901.1896897-1-tkaminsk@redhat.com>", "date": "2026-04-24T13:25:37", "name": "libsdc++: Restore check for validity of std::get for elements_view.", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d35839425b4a374a19f224f26fc8f474e674449f", "submitter": { "id": 90409, "url": "http://patchwork.ozlabs.org/api/1.1/people/90409/?format=api", "name": "Tomasz Kamiński", "email": "tkaminsk@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260424132901.1896897-1-tkaminsk@redhat.com/mbox/", "series": [ { "id": 501365, "url": "http://patchwork.ozlabs.org/api/1.1/series/501365/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501365", "date": "2026-04-24T13:25:37", "name": "libsdc++: Restore check for validity of std::get for elements_view.", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501365/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2227911/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2227911/checks/", "tags": {}, "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=JMlT+OWM;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=JMlT+OWM", "sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com", "sourceware.org; spf=pass smtp.mailfrom=redhat.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.133.124" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g2DMk3GLpz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 23:29:37 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 12B9C4BB58DA\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 13:29:35 +0000 (GMT)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by sourceware.org (Postfix) with ESMTP id BBC694BB5883\n for <gcc-patches@gcc.gnu.org>; Fri, 24 Apr 2026 13:29:06 +0000 (GMT)", "from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-52-cLKO6g8LNLOmhT6ph3IsRQ-1; Fri,\n 24 Apr 2026 09:29:05 -0400", "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id E5D1D195605C; Fri, 24 Apr 2026 13:29:03 +0000 (UTC)", "from localhost (unknown [10.44.48.150])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 6D0BE1944CED; Fri, 24 Apr 2026 13:29:03 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 12B9C4BB58DA", "OpenDKIM Filter v2.11.0 sourceware.org BBC694BB5883" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org BBC694BB5883", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org BBC694BB5883", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777037346; cv=none;\n b=Tkbhxc+Ywg+SmAcFI+5fWNRgTuayTByETAmJ3hsxkCogXJ+gDiY+ODFP8QnNDO0GKL52OjYZ0FX8dXGO1v07cRnRDL3ShePvc2TWPlvkVuNZsWe6iTJi7WkVLYmcQB5uVaUgkXhXWGf3LUmP6M1FWuwn9cR4hQHlqAghcOiA+9M=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777037346; c=relaxed/simple;\n bh=DNZLtMcMHizbDHPSMWe/Ha0fij4HXFreUpv9iy5eRRY=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=OUhLbL2Jh5box78HOvAZf/gLCAcEDP4GevhJsbUYLrSKkQ2Wi68NUOcnyWhhP+QXldsnv1Pi0++XJ2hSRpfbe/urGC2PJHCHcPLWf+F953ZMUWqxim/xsnnKQYgwEma7iLyelT6CO4uM5JsfM5lX6ctGDtaeXEkCP5j05m7t4gA=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777037346;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=3U+S6m8/zxJ+2UGmQGunAj1HOlO8w82ocU+cN9NzI0o=;\n b=JMlT+OWMYDOSMA3YrTRBlSQ2MhJAb+ybDGnragMPpg0pZiX/mbOCHXD8YF1YLTzE2juMeW\n /7DHNH6Y+kGUcPUycpVTfYmyRLuyefvHxZtLhybFrqRQxbJ8IKXc3hYkNneypm5uQjEp0U\n cjU9PqkA3r9rAPlJfJcvkSdPdB0AWto=", "X-MC-Unique": "cLKO6g8LNLOmhT6ph3IsRQ-1", "X-Mimecast-MFC-AGG-ID": "cLKO6g8LNLOmhT6ph3IsRQ_1777037344", "From": "=?utf-8?q?Tomasz_Kami=C5=84ski?= <tkaminsk@redhat.com>", "To": "libstdc++@gcc.gnu.org,\n\tgcc-patches@gcc.gnu.org", "Subject": "[PATCH] libsdc++: Restore check for validity of std::get for\n elements_view.", "Date": "Fri, 24 Apr 2026 15:25:37 +0200", "Message-ID": "<20260424132901.1896897-1-tkaminsk@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": "KDzjnUHsrpKUP8KCFlFiLPJ0OZEnp6odQs7D9kAS7Rc_1777037344", "X-Mimecast-Originator": "redhat.com", "Content-Transfer-Encoding": "8bit", "content-type": "text/plain; charset=\"US-ASCII\"; x-default=true", "X-BeenThere": "gcc-patches@gcc.gnu.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>", "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>", "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "Resolves LWG3797, \"elements_view insufficiently constrained\".\n\nWhen P2165R4 updated __has_tuple_element in C++23 to reuse __tuple_like\nconcept, it dropped the requirement of validity of get, assuming that for\ntuple_like type with size of N, get<I> on lvalue is well-formed for any I < N.\nThis however does not hold for ranges::subrange (tuple-like of size 2) with\nmove-only iterator, for which get can only be applied on rvalue. In consequence\nconstrains allowed instantiating elements_view for range of such subrange,\nbut instantiating it's iterator lead to hard error from iterator_category\ncomputation.\n\nThis patch applies the requirements on validity of get in all standard\nmodes.\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/std/ranges (__detail::__has_tuple_element): Check\n\tif std::get<_Nm>(__t) returns referenceable type also for C++23\n\tand later.\n\t* testsuite/std/ranges/adaptors/elements.cc: Add test covering\n\tvector of ranges::subrange with move-only iterator.\n---\nI initially tought that we should backport it, but the only impact of\nthe issues is you cannot rely on constraint check on views::elements\nof such range. Any use of such elements_views remain ill-formed in\nall modes.\n\nTesting on x86-64_linux. All *elements* test passed in all standard\nmodes. OK for trunk when all test passes?\n\n libstdc++-v3/include/std/ranges | 15 ++++++++++-----\n .../testsuite/std/ranges/adaptors/elements.cc | 15 +++++++++++++++\n 2 files changed, 25 insertions(+), 5 deletions(-)", "diff": "diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges\nindex 55d3c520ba4..4eb0a1a25bf 100644\n--- a/libstdc++-v3/include/std/ranges\n+++ b/libstdc++-v3/include/std/ranges\n@@ -4354,20 +4354,25 @@ namespace views::__adaptor\n \n namespace __detail\n {\n-#if __cpp_lib_tuple_like // >= C++23\n+ // _GLIBCXX_RESOLVE_LIB_DEFECTS\n+ // 3797. elements_view insufficiently constrained\n template<typename _Tp, size_t _Nm>\n- concept __has_tuple_element = __tuple_like<_Tp> && _Nm < tuple_size_v<_Tp>;\n+ concept __has_tuple_element =\n+#if __cpp_lib_tuple_like // >= C++23\n+ __tuple_like<_Tp> && _Nm < tuple_size_v<_Tp>\n #else\n- template<typename _Tp, size_t _Nm>\n- concept __has_tuple_element = requires(_Tp __t)\n+ requires\n {\n \ttypename tuple_size<_Tp>::type;\n \trequires _Nm < tuple_size_v<_Tp>;\n \ttypename tuple_element_t<_Nm, _Tp>;\n+ }\n+#endif\n+ && requires(_Tp __t)\n+ {\n \t{ std::get<_Nm>(__t) }\n \t -> convertible_to<const tuple_element_t<_Nm, _Tp>&>;\n };\n-#endif\n \n template<typename _Tp, size_t _Nm>\n concept __returnable_element\ndiff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc\nindex 5237d787e7b..1b15f79c5be 100644\n--- a/libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc\n+++ b/libstdc++-v3/testsuite/std/ranges/adaptors/elements.cc\n@@ -27,6 +27,21 @@\n namespace ranges = std::ranges;\n namespace views = ranges::views;\n \n+template<size_t N, typename Rg>\n+concept can_elements = requires (Rg&& rg)\n+{ views::elements<0>(rg); };\n+\n+static_assert( !can_elements<0, std::vector<int>> );\n+static_assert( can_elements<0, std::tuple<int>[4]> );\n+static_assert( can_elements<1, std::vector<std::pair<int, int>>> );\n+\n+using move_only_iter_range = __gnu_test::test_input_range_nocopy<int>;\n+using move_only_iter_subrange = ranges::subrange<\n+ ranges::iterator_t<move_only_iter_range>,\n+ ranges::sentinel_t<move_only_iter_range>>;\n+static_assert( can_elements<0, std::vector<ranges::subrange<int*>>> );\n+static_assert( !can_elements<0, std::vector<move_only_iter_subrange>> );\n+\n void\n test01()\n {\n", "prefixes": [] }