{"id":2224566,"url":"http://patchwork.ozlabs.org/api/patches/2224566/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260417154009.1140472-1-ppalka@redhat.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/projects/17/?format=json","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,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260417154009.1140472-1-ppalka@redhat.com>","list_archive_url":null,"date":"2026-04-17T15:40:09","name":"libstdc++: Fix constraint recursion in std:indirect's operator== [PR124890]","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"758610638ce6e21a4ee6eec93cb010e0cc4bd5f4","submitter":{"id":78319,"url":"http://patchwork.ozlabs.org/api/people/78319/?format=json","name":"Patrick Palka","email":"ppalka@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260417154009.1140472-1-ppalka@redhat.com/mbox/","series":[{"id":500367,"url":"http://patchwork.ozlabs.org/api/series/500367/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=500367","date":"2026-04-17T15:40:09","name":"libstdc++: Fix constraint recursion in std:indirect's operator== [PR124890]","version":1,"mbox":"http://patchwork.ozlabs.org/series/500367/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224566/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2224566/checks/","tags":{},"related":[],"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=KcpylH25;\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=KcpylH25","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 4fxzcM39tMz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 18 Apr 2026 01:40:49 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id E78774CCCA35\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 15:40:45 +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 D69664BA2E07\n for <gcc-patches@gcc.gnu.org>; Fri, 17 Apr 2026 15:40:18 +0000 (GMT)","from mail-qk1-f199.google.com (mail-qk1-f199.google.com\n [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-298-cyw5SUG9Oyui0cAZ7ZD1MQ-1; Fri, 17 Apr 2026 11:40:17 -0400","by mail-qk1-f199.google.com with SMTP id\n af79cd13be357-8cff2297253so21250585a.2\n for <gcc-patches@gcc.gnu.org>; Fri, 17 Apr 2026 08:40:17 -0700 (PDT)","from idea ([2600:4040:aa66:bf00:9e8e:99ff:fed1:71f])\n by smtp.gmail.com with ESMTPSA id\n af79cd13be357-8e7d8edd93dsm131718085a.26.2026.04.17.08.40.14\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 17 Apr 2026 08:40:14 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org E78774CCCA35","OpenDKIM Filter v2.11.0 sourceware.org D69664BA2E07"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org D69664BA2E07","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org D69664BA2E07","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776440418; cv=none;\n b=s0Ber+e/G6Zz5h0Ced89u5ODe7OjTlZ99n9KzbhwIf/g//vqOtkc3bbkg5lfPHSjYB6gcvNVdJHLuwN1dPRIPaiAZzZSes8IP1Evteg6X1M6HMdnc+sUv8y+t2wQz8oEs+GBHVcMa6QFjPh1KeYGq4C2ghq+xjaiFvJ9SD8rFS8=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776440418; c=relaxed/simple;\n bh=mHfHghyoDOLTNHsjNxxucM0uAOASc/ZhiG9/FzfZGg0=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=A7Dv7cooaTU+zB9uIAtSUd1dwFfPg1IlqWuffNizvtIOqV2qoxqyyXQShC4ku3FpKFQ0vawun/SD8n6miCRdXSv02TlWHJM2+nsffXRlWAYfMhLg6MGiIUEoow3TYi5ecBV7j8uzXIgM/c9PIJ4hfxVhjciVClbkfOj6s7q3F7A=","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=1776440418;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=vdFKe93bKi1LvBc570ETaEC/GasOEi5i4DaPrOaOBBA=;\n b=KcpylH25HqM4NiJG9WcXNj/yHM/tsYnwC+OL7GLBGRdu8GOoeIcAWV/+YGz61Cr32mE7ue\n u1XynT4cHVmqeIueTgBOoNM8OgMdPoofLJejFz1uzM2M4vTGRYpfLIfIcV/MX8pWQbjG1B\n USvAeG0YPBBjXc6iYWFST/RtcUt0WwA=","X-MC-Unique":"cyw5SUG9Oyui0cAZ7ZD1MQ-1","X-Mimecast-MFC-AGG-ID":"cyw5SUG9Oyui0cAZ7ZD1MQ_1776440417","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776440416; x=1777045216;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=vdFKe93bKi1LvBc570ETaEC/GasOEi5i4DaPrOaOBBA=;\n b=ecMtmg82QyCbZYgE/rwB1q8GwvTVA5AUns/9s0EV3HVs2QVMHcJxNlYF54jhvV3J3X\n 4FufcFTubXwtrnN6SCnXbbDegBgaHp6aZf0Ok/1UHZrR768DwGQ/iuEotleiE15nfpli\n Cjwob0Gy2xJXvnsWa5PTeLfwJJiqN1sV0NP4eRR0q/LxJ3tiYTUxIX39ffZBsswi3Idp\n cJTMJJ/UQVngVEaDcCF6Dl73q3+D6/A3a6i+QXDgumLD8H/LYuodAv2uOC4adMzzj4vc\n cmCBTTWAW436hSaD0nSmdC2NCSneE7jrh0p9VLioe2/rUBgqeEFCusz+QQ3ukf+d751b\n 7P0g==","X-Gm-Message-State":"AOJu0YyaHpenStARoB+FSMbB8gO+VQfyAvX7UP2pI7hj4EWqeUsjOgwc\n iOvjJ5VAn9qczSAcEjoPdJLD0hPp68cK8Q/a0yGnaEqoR3tIXe8doj913LL4UxoMRTr/ZaTmb4U\n p7ShMHRJ2OHIdQT+z9chZrvawZ5KdYuDZgJ4/ZmlX5Opy02kukwuwFrGxi200XNgy/kj6Q9mcZm\n oVle0Xjni8fAOnbcnmAk1Mq2hdsyEXlcC2c9MC2mqP","X-Gm-Gg":"AeBDietipIv9Yo6qxqogJdGj5ad9sFifqayQMquJqEZPxJL7T4I+TS0h/xYcHFQ4M4v\n IAUMmND6s27qXQrynxmtvl4cqmv4cVKZGtnQTeya3GO1wN9uz4qT/mdk7d6bfuqOMfWfjQGEj8m\n tUsYm0EAc1sU7M9Kx+OUtHUcybtMft+A00T+71UrPMZMDUN3Ba7M5DtO2N+DUslJrNn1Fpw73dG\n xKtDSatsK3xFsWnfAoot0cOYgtqAnYdEv38NVrY9zAwYdlcXzwKiac44S5dwsnw29I6321PbDV3\n YjbZDdEAQHcqgYHik3osMO77h7zi1R6hg7MwbqSsMa8902ZWm7qRxut+J7mAG/PeOGolkygyT3e\n UXw5CBpL2uWR2mzB2M8mUIqE=","X-Received":["by 2002:a05:620a:4694:b0:8d7:a89d:958a with SMTP id\n af79cd13be357-8e791c8e121mr302086585a.6.1776440415864;\n Fri, 17 Apr 2026 08:40:15 -0700 (PDT)","by 2002:a05:620a:4694:b0:8d7:a89d:958a with SMTP id\n af79cd13be357-8e791c8e121mr302081085a.6.1776440415141;\n Fri, 17 Apr 2026 08:40:15 -0700 (PDT)"],"From":"Patrick Palka <ppalka@redhat.com>","To":"gcc-patches@gcc.gnu.org","Cc":"libstdc++@gcc.gnu.org,\n\tPatrick Palka <ppalka@redhat.com>","Subject":"[PATCH] libstdc++: Fix constraint recursion in std:indirect's\n operator== [PR124890]","Date":"Fri, 17 Apr 2026 11:40:09 -0400","Message-ID":"<20260417154009.1140472-1-ppalka@redhat.com>","X-Mailer":"git-send-email 2.54.0.rc1.54.g60f07c4f5c","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"gR1GQk9tJzUa08ge0KKkfgmZ-b4JOzMzyV2r1TOPd1s_1776440417","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","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":"Tested on x86_64-pc-linux-gnu, does this look OK for trunk?\n\nWe can also just implement the Mandates as a static_assert as pointed\nout by Lénárd.  Otherwise, I prefer this approach rather than the\nforwarding reference approach since it's cleaner and we use this approach\nin other parts of the library with no complaints so far.\n\n-- >8 --\n\nLike in r16-559 for std::expected, std::indirect's operator== is also\nprone to constraint recursion due to CWG 2369.  This patch works around\nthe recursion in a similar manner.\n\n\tPR libstdc++/124890\n\tPR libstdc++/119714\n\tPR libstdc++/112490\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/indirect.h (indirect::operator==): Replace\n\tnon-dependent std::indirect function parameter with a\n\tdependent one of type indirect<_Tp2> where _Tp2 matches _Tp.\n\t* testsuite/std/memory/indirect/124890.cc: New test.\n---\n libstdc++-v3/include/bits/indirect.h                 | 4 ++--\n libstdc++-v3/testsuite/std/memory/indirect/124890.cc | 9 +++++++++\n 2 files changed, 11 insertions(+), 2 deletions(-)\n create mode 100644 libstdc++-v3/testsuite/std/memory/indirect/124890.cc","diff":"diff --git a/libstdc++-v3/include/bits/indirect.h b/libstdc++-v3/include/bits/indirect.h\nindex 2df46cc39a21..e1f7d1968b56 100644\n--- a/libstdc++-v3/include/bits/indirect.h\n+++ b/libstdc++-v3/include/bits/indirect.h\n@@ -344,11 +344,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t    return __lhs.__get() == __rhs.__get();\n \t}\n \n-      template<typename _Up>\n+      template<same_as<_Tp> _Tp2, typename _Up>\n \trequires (!__is_indirect<_Up>) // See PR c++/99599\n \t  && requires (const _Tp& __t, const _Up& __u) { __t == __u; }\n \tfriend constexpr bool\n-\toperator==(const indirect& __lhs, const _Up& __rhs)\n+\toperator==(const indirect<_Tp2>& __lhs, const _Up& __rhs)\n \tnoexcept(noexcept(*__lhs == __rhs))\n \t{\n \t  if (!__lhs._M_objp)\ndiff --git a/libstdc++-v3/testsuite/std/memory/indirect/124890.cc b/libstdc++-v3/testsuite/std/memory/indirect/124890.cc\nnew file mode 100644\nindex 000000000000..ce44256f2244\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/std/memory/indirect/124890.cc\n@@ -0,0 +1,9 @@\n+// { dg-do compile { target c++26 } }\n+\n+// PR libstdc++/124890 - Circular constraint in std::indirect::operator==\n+\n+#include <memory>\n+#include <vector>\n+\n+using I = std::vector<std::indirect<int>>::iterator;\n+static_assert(std::totally_ordered<I>);\n","prefixes":[]}