{"id":2227079,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2227079/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260423081716.698403-1-tkaminsk@redhat.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.1/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},"msgid":"<20260423081716.698403-1-tkaminsk@redhat.com>","date":"2026-04-23T08:16:25","name":"[v2] libstdc++: Include bool conversion in noexcept specification of indirect::operator==.","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"aed82b9a571b3f899dbc4b0fbb15082225bbda71","submitter":{"id":90409,"url":"http://patchwork.ozlabs.org/api/1.1/people/90409/?format=json","name":"Tomasz Kamiński","email":"tkaminsk@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260423081716.698403-1-tkaminsk@redhat.com/mbox/","series":[{"id":501157,"url":"http://patchwork.ozlabs.org/api/1.1/series/501157/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=501157","date":"2026-04-23T08:16:25","name":"[v2] libstdc++: Include bool conversion in noexcept specification of indirect::operator==.","version":2,"mbox":"http://patchwork.ozlabs.org/series/501157/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2227079/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2227079/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=VBpsbOml;\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=VBpsbOml","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.129.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 4g1TVd2N5Hz1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 18:17:59 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id ED4F94BBCD99\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 08:17:57 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id EEF154BBC0A2\n for <gcc-patches@gcc.gnu.org>; Thu, 23 Apr 2026 08:17:20 +0000 (GMT)","from mx-prod-mc-05.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-609-yeu-BTDIMMuEPgvLZ0diCA-1; Thu,\n 23 Apr 2026 04:17:19 -0400","from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])\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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 4DFB21956095; Thu, 23 Apr 2026 08:17:18 +0000 (UTC)","from localhost (unknown [10.44.34.53])\n by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id CB1C0180047F; Thu, 23 Apr 2026 08:17:17 +0000 (UTC)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org ED4F94BBCD99","OpenDKIM Filter v2.11.0 sourceware.org EEF154BBC0A2"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org EEF154BBC0A2","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org EEF154BBC0A2","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776932241; cv=none;\n b=LDnCh+ve1X1uWPueNpJQ5ppyhTE2K7afAXf+51H4ZzmuyybLGfzdO7prCbEwy6R40vdl/5ywB9+AjRaZ4fwwnh2y5ratEUWLnL1aclhCQrZ27qyP8OoIEZI/yykvJkxSgAlunbnftwmlrrsCnkf4SoIPM6qDxWdq38KIUIsuW6M=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776932241; c=relaxed/simple;\n bh=QtjR9/daOhf/Mm2O0NIW8mhOKjeYXGbgXHYu6TA3nHE=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=PxkHKoyWI0evxKSVWLEZ1urWKS6ATIOh+wHslc1vUWWb+9S9ORW0BJ41hPVjxcqaDC8gDMMpoFPxLTgXpLmXpsNGKOrSm6lLBoXO43WrYfk58kitSxRgZkASBct1D/q53yTaztLabNTX8FZYN7v6wmmygGfhAQb+qVKBH02NuTA=","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=1776932240;\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 in-reply-to:in-reply-to:references:references;\n bh=NTlWZz1HTYDuE4aPOkA5jznw2A1/dgEobgRjPcAHcrI=;\n b=VBpsbOmlOsC8OZMtqVBrjln9M3vqMOTV6tv5YPyNaxkRaVgxiCFx82+ujSKwmQXH9OBCFQ\n nTEjmE/SA5gjD95sIUjCdAHqV4876GN0o2+vV0KY8UmNOluJpQPa/07P7OnvYlVSkzipGI\n LQyLFTve2RkSVzh0I+nFdlZroZFqPYY=","X-MC-Unique":"yeu-BTDIMMuEPgvLZ0diCA-1","X-Mimecast-MFC-AGG-ID":"yeu-BTDIMMuEPgvLZ0diCA_1776932238","From":"=?utf-8?q?Tomasz_Kami=C5=84ski?= <tkaminsk@redhat.com>","To":"libstdc++@gcc.gnu.org,\n\tgcc-patches@gcc.gnu.org","Subject":"[PATCH v2] libstdc++: Include bool conversion in noexcept\n specification of indirect::operator==.","Date":"Thu, 23 Apr 2026 10:16:25 +0200","Message-ID":"<20260423081716.698403-1-tkaminsk@redhat.com>","In-Reply-To":"\n <CACb0b4mj-AUJwG0tFqoHvObSjp_X3adn7PQm-s1ztJAtH2qOyw@mail.gmail.com>","References":"\n <CACb0b4mj-AUJwG0tFqoHvObSjp_X3adn7PQm-s1ztJAtH2qOyw@mail.gmail.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.4.1 on 10.30.177.93","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"ctTYMOrhLPS_sS1LWHWJLU33YXp6I7WOG5jjoU_J828_1776932238","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":"This expands the resolution of LWG4325 to heterogenous comparision\nwith T per standard draft (see corresponding commit [1]).\n\n[1] https://github.com/cplusplus/draft/pull/8935/changes/833d635d648cdbd06c9935acccf925ee0aea3c79\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/indirect.h (indirect::operator==): Adjust\n\tnoexcept specification.\n\t* testsuite/std/memory/indirect/relops.cc: New test for noexcept\n\tspecification.\n\nSigned-off-by: Tomasz Kamiński <tkaminsk@redhat.com>\n---\nv2 adds test for noexcept of relation operators (libsdc++ extension).\n\nTested on x86_64-linux. OK for trunk?\n\n libstdc++-v3/include/bits/indirect.h          |  4 +-\n .../testsuite/std/memory/indirect/relops.cc   | 72 +++++++++++++++++++\n 2 files changed, 74 insertions(+), 2 deletions(-)","diff":"diff --git a/libstdc++-v3/include/bits/indirect.h b/libstdc++-v3/include/bits/indirect.h\nindex 6490a77a507..5be6713eaf3 100644\n--- a/libstdc++-v3/include/bits/indirect.h\n+++ b/libstdc++-v3/include/bits/indirect.h\n@@ -336,7 +336,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \trequires requires (const _Tp& __t, const _Up& __u) { __t == __u; }\n \tfriend constexpr bool\n \toperator==(const indirect& __lhs, const indirect<_Up, _Alloc2>& __rhs)\n-\tnoexcept(noexcept(*__lhs == *__rhs))\n+\tnoexcept(noexcept(bool(*__lhs == *__rhs)))\n \t{\n \t  if (!__lhs._M_objp || !__rhs._M_objp)\n \t    return bool(__lhs._M_objp) == bool(__rhs._M_objp);\n@@ -349,7 +349,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t  && requires (const _Tp& __t, const _Up& __u) { __t == __u; }\n \tfriend constexpr bool\n \toperator==(const indirect<_Vp, _Alloc>& __lhs, const _Up& __rhs)\n-\tnoexcept(noexcept(*__lhs == __rhs))\n+\tnoexcept(noexcept(bool(*__lhs == __rhs)))\n \t{\n \t  if (!__lhs._M_objp)\n \t    return false;\ndiff --git a/libstdc++-v3/testsuite/std/memory/indirect/relops.cc b/libstdc++-v3/testsuite/std/memory/indirect/relops.cc\nindex 77d599c8086..fb957a7ad3d 100644\n--- a/libstdc++-v3/testsuite/std/memory/indirect/relops.cc\n+++ b/libstdc++-v3/testsuite/std/memory/indirect/relops.cc\n@@ -68,11 +68,83 @@ test_hash()\n   (void)std::hash<std::indirect<Obj>>{}(i);\n }\n \n+template<bool Noexcept>\n+struct BoolConv\n+{\n+  bool b;\n+\n+  constexpr BoolConv(bool p) noexcept\n+  : b(p)\n+  { }\n+\n+  constexpr operator bool() const noexcept(Noexcept)\n+  { return b; }\n+};\n+\n+template<bool Noexcept, typename EqRet = bool>\n+struct Comp\n+{\n+  friend constexpr EqRet\n+  operator==(const Comp&, const Comp&) noexcept(Noexcept)\n+  { return true; }\n+\n+  friend constexpr std::strong_ordering\n+  operator<=>(const Comp&, const Comp&) noexcept(Noexcept)\n+  { return std::strong_ordering::equal; }\n+};\n+\n+template<bool Noexcept, typename T>\n+void test_noexcept_eq(T t)\n+{\n+  std::indirect<T> i(t);\n+  static_assert(noexcept(i == t) == Noexcept);\n+  static_assert(noexcept(i != t) == Noexcept);\n+  static_assert(noexcept(i == i) == Noexcept);\n+  static_assert(noexcept(i != i) == Noexcept);\n+}\n+\n+template<bool Noexcept, typename T>\n+void test_noexcept_rel(T t)\n+{\n+  std::indirect<T> i(t);\n+  static_assert(noexcept(i < t) == Noexcept);\n+  static_assert(noexcept(i > t) == Noexcept);\n+  static_assert(noexcept(i <= t) == Noexcept);\n+  static_assert(noexcept(i >= t) == Noexcept);\n+  static_assert(noexcept(i <=> t) == Noexcept);\n+\n+  static_assert(noexcept(t < i) == Noexcept);\n+  static_assert(noexcept(t > i) == Noexcept);\n+  static_assert(noexcept(t <= i) == Noexcept);\n+  static_assert(noexcept(t >= i) == Noexcept);\n+  static_assert(noexcept(t <=> i) == Noexcept);\n+\n+  static_assert(noexcept(i < i) == Noexcept);\n+  static_assert(noexcept(i > i) == Noexcept);\n+  static_assert(noexcept(i <= i) == Noexcept);\n+  static_assert(noexcept(i >= i) == Noexcept);\n+  static_assert(noexcept(i <=> i) == Noexcept);\n+}\n+\n+void test_noexcept()\n+{\n+  test_noexcept_eq<true>(Comp<true>());\n+  test_noexcept_eq<false>(Comp<false>());\n+  test_noexcept_rel<true>(Comp<true>());\n+  test_noexcept_rel<false>(Comp<false>());\n+\n+  test_noexcept_eq<true>(Comp<true, BoolConv<true>>());\n+  test_noexcept_eq<false>(Comp<true, BoolConv<false>>());\n+  test_noexcept_eq<false>(Comp<false, BoolConv<true>>());\n+  test_noexcept_eq<false>(Comp<false, BoolConv<false>>());\n+}\n+\n int main()\n {\n   test_relops();\n   test_comp_with_t();\n   test_hash();\n+  test_noexcept();\n \n   static_assert([] {\n     test_relops();\n","prefixes":["v2"]}