Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2231567/?format=api
{ "id": 2231567, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2231567/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260430205935.2360603-1-jwakely@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": "<20260430205935.2360603-1-jwakely@redhat.com>", "date": "2026-04-30T20:58:54", "name": "libstdc++: Make std::unique_ptr::operator* SFINAE-friendly", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "a143e4b46d5a1807f84bbae8c3e4acdcf4db8966", "submitter": { "id": 48004, "url": "http://patchwork.ozlabs.org/api/1.1/people/48004/?format=api", "name": "Jonathan Wakely", "email": "jwakely@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260430205935.2360603-1-jwakely@redhat.com/mbox/", "series": [ { "id": 502384, "url": "http://patchwork.ozlabs.org/api/1.1/series/502384/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=502384", "date": "2026-04-30T20:58:54", "name": "libstdc++: Make std::unique_ptr::operator* SFINAE-friendly", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/502384/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2231567/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2231567/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=NIdakQp5;\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=NIdakQp5", "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 4g664q0XMMz1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 07:00:09 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 98A984143927\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 21:00:07 +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 24B924310D63\n for <gcc-patches@gcc.gnu.org>; Thu, 30 Apr 2026 20:59:41 +0000 (GMT)", "from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-261-qzTL_qPFNfGqH4p3puBOIA-1; Thu,\n 30 Apr 2026 16:59:39 -0400", "from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111])\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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 23BA01800364; Thu, 30 Apr 2026 20:59:38 +0000 (UTC)", "from zen.kayari.org (unknown [10.44.50.237])\n by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id DFF90180045E; Thu, 30 Apr 2026 20:59:36 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 98A984143927", "OpenDKIM Filter v2.11.0 sourceware.org 24B924310D63" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 24B924310D63", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 24B924310D63", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777582781; cv=none;\n b=V4LftH707h93eofCjFLAd8MaeZGp54XAd9XtRo+JF+ZCPqEBFfgp3UD6/FvWGctejdqqZVsyt6iIm3f+E2dc1TqSvwyZBGCcQduFVRbK1DT3li7JEGp8uxAIYObkfxvaTgaWXlEcP/KyNodKkyCQEir3LhD2GLoIet+pbPoDSdc=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777582781; c=relaxed/simple;\n bh=Pn9EvC7sOO96UM8C7slcuV7DS3EhzOKTIih8mH5p6Jo=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=GLKhsVTbm+1N5FZdj8VCNlIDDkywyNi2jj2yaRNPMhjAmaSKxUkXWhxYaPzjlL4pFvtwMJ6wwA/p5OrnOEeBPh3ym9p8aWcBXLbbf1RbZwdE2TtC0bXiao6COAmzxAxyHufSrAZNvFbnCrom2gREbXWg1ibrFp9YzTSvAIn1/tA=", "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=1777582780;\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=uImX6T6zszvH57pzdXKF1N05UxISADNK4yrB2LxGo3w=;\n b=NIdakQp5UfQlzkne8FzL6OfbYmAxd5r1+ZCNXZeTJvwn3fFJpSFJ2J8UtHUsLPVRfdS7Nt\n EahVEyZtVH3dXbPikMEBy/0fKKQB1rF9W4fu9YhdLkEuoVVJdGNCGHCMZvuKhxk5aiZH4t\n mBJF1JHR+NIoAx1Otx6ExHjT45wZKiQ=", "X-MC-Unique": "qzTL_qPFNfGqH4p3puBOIA-1", "X-Mimecast-MFC-AGG-ID": "qzTL_qPFNfGqH4p3puBOIA_1777582778", "From": "Jonathan Wakely <jwakely@redhat.com>", "To": "gcc-patches@gcc.gnu.org,\n\tlibstdc++@gcc.gnu.org", "Subject": "[PATCH] libstdc++: Make std::unique_ptr::operator* SFINAE-friendly", "Date": "Thu, 30 Apr 2026 21:58:54 +0100", "Message-ID": "<20260430205935.2360603-1-jwakely@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.111", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "Lw5kIAhntC-uiDgJgNWtpTUjRlv9iFa4D879ou8l51o_1777582778", "X-Mimecast-Originator": "redhat.com", "Content-Type": "text/plain", "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 implements LWG 4324, \"unique_ptr<void>::operator* is not\nSFINAE-friendly\", approved in Croydon, 2026.\n\nThe noexcept-specifier added to C++23 by LWG 2762 is ill-formed if the\npointer type cannot be dereferenced, which means that code which was\nchecking whether the function exists (e.g. in a SFINAE context) no\nlonger works. Such code was always questionable, because the function\nbody was ill-formed if the pointer isn't dereferenceable, so the SFINAE\ncheck was probably giving the wrong answer.\n\nLWG 4324 adds a constraint to the function, so that it doesn't\nparticipate in overload resolution if it would be ill-formed. That's\neasy to implement for C++20 because we can just add a requires-clause.\nFor C++11/14/17 we can't constrain it easily, so just adjust the\nnoexcept-specifier so that it's not ill-formed.\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/unique_ptr.h (unique_ptr::_Can_deref)\n\t(unique_ptr::_S_nothrow_deref): New helpers for pre-C++20.\n\t(operator*): Either constrain or use _S_nothrow_deref.\n\t* testsuite/20_util/unique_ptr/lwg4324.cc: New test.\n---\n\nTested x86_64-linux.\n\n libstdc++-v3/include/bits/unique_ptr.h | 42 ++++++++++++++++++-\n .../testsuite/20_util/unique_ptr/lwg4324.cc | 22 ++++++++++\n 2 files changed, 63 insertions(+), 1 deletion(-)\n create mode 100644 libstdc++-v3/testsuite/20_util/unique_ptr/lwg4324.cc", "diff": "diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h\nindex 5b7c8938ff74..222e61d221ed 100644\n--- a/libstdc++-v3/include/bits/unique_ptr.h\n+++ b/libstdc++-v3/include/bits/unique_ptr.h\n@@ -289,6 +289,37 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t __not_<is_array<_Up>>\n >;\n \n+#if ! __cpp_concepts\n+ template<typename _Ptr, typename = void>\n+\tstruct _Can_deref\n+\t: false_type { };\n+\n+ template<typename _Ptr>\n+\tstruct _Can_deref<_Ptr, __void_t<decltype(*std::declval<_Ptr>())>>\n+\t: true_type { };\n+\n+#if __cpp_constexpr >= 201304L // C++14 relaxed constexpr\n+#pragma GCC diagnostic push\n+#pragma GCC diagnostic ignored \"-Wc++17-extensions\" // if constexpr\n+ template<typename _Ptr>\n+\tstatic constexpr bool\n+\t_S_nothrow_deref(int)\n+\t{\n+\t if constexpr (_Can_deref<_Ptr>::value)\n+\t return noexcept(*std::declval<_Ptr>());\n+\t return false;\n+\t}\n+#pragma GCC diagnostic pop\n+#else\n+ template<typename _Ptr, typename = decltype(*std::declval<_Ptr>())>\n+\tstatic constexpr bool\n+\t_S_nothrow_deref(int) { return noexcept(*std::declval<_Ptr>()); }\n+ template<typename _Ptr>\n+\tstatic constexpr bool\n+\t_S_nothrow_deref(...) { return false; }\n+#endif\n+#endif\n+\n public:\n // Constructors.\n \n@@ -442,7 +473,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n /// Dereference the stored pointer.\n _GLIBCXX23_CONSTEXPR\n typename add_lvalue_reference<element_type>::type\n- operator*() const noexcept(noexcept(*std::declval<pointer>()))\n+ operator*() const\n+ // _GLIBCXX_RESOLVE_LIB_DEFECTS\n+ // 2762. unique_ptr operator*() should be noexcept\n+ // 4324. unique_ptr<void>::operator* is not SFINAE-friendly\n+#if __cpp_concepts\n+ noexcept(noexcept(*std::declval<pointer>()))\n+ requires requires { *std::declval<pointer>(); }\n+#else\n+ noexcept(_S_nothrow_deref<pointer>(0))\n+#endif\n {\n #if _GLIBCXX_USE_BUILTIN_TRAIT(__reference_converts_from_temporary)\n \t// _GLIBCXX_RESOLVE_LIB_DEFECTS\ndiff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/lwg4324.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/lwg4324.cc\nnew file mode 100644\nindex 000000000000..13ebfb929fca\n--- /dev/null\n+++ b/libstdc++-v3/testsuite/20_util/unique_ptr/lwg4324.cc\n@@ -0,0 +1,22 @@\n+// { dg-do compile { target c++11 } }\n+\n+// LWG 4324. unique_ptr<void>::operator* is not SFINAE-friendly\n+\n+#include <memory>\n+\n+template<class T, bool = true>\n+struct nothrow_dereference\n+: std::false_type { };\n+\n+template<class T>\n+struct nothrow_dereference<T, noexcept(*std::declval<T>())>\n+: std::true_type { };\n+\n+static_assert( nothrow_dereference<std::unique_ptr<int>>::value, \"\");\n+static_assert( ! nothrow_dereference<std::unique_ptr<void>>::value, \"\");\n+\n+#if __cplusplus >= 202002L // C++20\n+template<class T> concept dereferenceable = requires(T& t) { *t; };\n+static_assert( dereferenceable<std::unique_ptr<int>>);\n+static_assert(!dereferenceable<std::unique_ptr<void>>);\n+#endif\n", "prefixes": [] }