get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2226789/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2226789,
    "url": "http://patchwork.ozlabs.org/api/patches/2226789/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhupath8dc.gcc.gcc-TEST.tkaminsk.107.1.2@forge-stage.sourceware.org/",
    "project": {
        "id": 17,
        "url": "http://patchwork.ozlabs.org/api/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,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<bmm.hhupath8dc.gcc.gcc-TEST.tkaminsk.107.1.2@forge-stage.sourceware.org>",
    "list_archive_url": null,
    "date": "2026-04-22T18:55:18",
    "name": "[v1,02/13] Fixups",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "3268c71728bb1f10147b018180f2bae5db105e9b",
    "submitter": {
        "id": 93223,
        "url": "http://patchwork.ozlabs.org/api/people/93223/?format=api",
        "name": "tkaminsk via Sourceware Forge",
        "email": "forge-bot+tkaminsk@forge-stage.sourceware.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhupath8dc.gcc.gcc-TEST.tkaminsk.107.1.2@forge-stage.sourceware.org/mbox/",
    "series": [
        {
            "id": 501097,
            "url": "http://patchwork.ozlabs.org/api/series/501097/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501097",
            "date": "2026-04-22T18:55:20",
            "name": "libstdc++: optional<T&> (P2988R12)",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/501097/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2226789/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2226789/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 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; dmarc=none (p=none dis=none)\n header.from=forge-stage.sourceware.org",
            "sourceware.org;\n spf=pass smtp.mailfrom=forge-stage.sourceware.org",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=38.145.34.39"
        ],
        "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 4g191v55Rrz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 05:55:31 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id AF9A548578D2\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 19:55:29 +0000 (GMT)",
            "from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39])\n by sourceware.org (Postfix) with ESMTPS id 26D1D409EB7A\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 18:56:23 +0000 (GMT)",
            "from forge-stage.sourceware.org (localhost [IPv6:::1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256)\n (No client certificate requested)\n by forge-stage.sourceware.org (Postfix) with ESMTPS id 041D5435B3\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 18:56:23 +0000 (UTC)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org AF9A548578D2",
            "OpenDKIM Filter v2.11.0 sourceware.org 26D1D409EB7A"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 26D1D409EB7A",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 26D1D409EB7A",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776884183; cv=none;\n b=FGgTan3cntHwHgpMsETrxldBt25LhhQUdtsPO1EM13oOyPRWIrKmVOXS/b6GAFGdd88/oYH750jC4FR3NkZezHfiBDWHF40svPirf9+ZruAsDBFVkJUV0VzAWYlHY5ZlJbhrvPaSXGeBZ3gfIOEtDUNHqhwT0u+4EkrS/3ufxqI=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776884183; c=relaxed/simple;\n bh=ONAkW0LHs6nPyKN8nnu7E9zbWCgkYKzPlnOBRmAI9PU=;\n h=From:Date:Subject:MIME-Version:To:Message-ID;\n b=g4onqK0+vPc7CMUYt5fDzaLUhR32U1skmdNWNdJIPYSPD40aQ0PqM517t7aDu1PCEFHqmn6zN/SosVXOcUdTkKrpQM+bNMyn/bWp+mpD2m3i6hOIL6I9uA9wc/2lGBCqNBznLIOVYW55N5uoGg7JV5OH6n7IfMWJprUP2BrLi3w=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "From": "tkaminsk via Sourceware Forge\n <forge-bot+tkaminsk@forge-stage.sourceware.org>",
        "Date": "Wed, 22 Apr 2026 18:55:18 +0000",
        "Subject": "[PATCH v1 02/13] Fixups",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>",
        "Message-ID": "\n <bmm.hhupath8dc.gcc.gcc-TEST.tkaminsk.107.1.2@forge-stage.sourceware.org>",
        "X-Mailer": "batrachomyomachia",
        "X-Pull-Request-Organization": "gcc",
        "X-Pull-Request-Repository": "gcc-TEST",
        "X-Pull-Request": "https://forge.sourceware.org/gcc/gcc-TEST/pulls/107",
        "References": "\n <bmm.hhupath8dc.gcc.gcc-TEST.tkaminsk.107.1.0@forge-stage.sourceware.org>",
        "In-Reply-To": "\n <bmm.hhupath8dc.gcc.gcc-TEST.tkaminsk.107.1.0@forge-stage.sourceware.org>",
        "X-Patch-URL": "\n https://forge.sourceware.org/tkaminsk/gcc/commit/fd7397681cb625a9cd87958b9c80fdffe2ff88ff",
        "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>",
        "Reply-To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>,\n tkaminsk@gcc.gnu.org",
        "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"
    },
    "content": "From: Tomasz Kamiński <tkaminsk@redhat.com>\n\nImplements different resolution for 4015, using operator*.\nLWG4300, 4304, 4367\n\nApproaches swap differently.\n---\n libstdc++-v3/include/std/optional | 109 +++++++++++++-----------------\n 1 file changed, 47 insertions(+), 62 deletions(-)",
    "diff": "diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional\nindex 2f61b2e0ae99..581ff8e063c2 100644\n--- a/libstdc++-v3/include/std/optional\n+++ b/libstdc++-v3/include/std/optional\n@@ -783,11 +783,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n #if __cpp_lib_optional >= 202506L\n \tis_lvalue_reference_v<_Tp> ||\n #endif\n-\t(is_object_v<_Tp> && !is_array_v<_Tp>)\n+\t(is_object_v<_Tp> && is_destructible_v<_Tp> && !is_array_v<_Tp>)\n       )\n       && !is_same_v<remove_cv_t<remove_reference_t<_Tp>>, nullopt_t>\n-      && !is_same_v<remove_cv_t<remove_reference_t<_Tp>>, in_place_t>\n-      && (!is_object_v<_Tp> || is_destructible_v<_Tp>);\n+      && !is_same_v<remove_cv_t<remove_reference_t<_Tp>>, in_place_t>;\n \n   /**\n     * @brief Class template for optional values.\n@@ -904,7 +903,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tnoexcept(is_nothrow_constructible_v<_Tp, const _Up&>)\n \t{\n \t  if (__t)\n-\t    emplace(__t._M_get());\n+\t    emplace(__t.operator*());\n \t}\n \n       template<typename _Up>\n@@ -916,7 +915,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tnoexcept(is_nothrow_constructible_v<_Tp, _Up>)\n \t{\n \t  if (__t)\n-\t    emplace(std::move(__t._M_get()));\n+\t    emplace(std::move(__t).operator*());\n \t}\n \n       template<typename... _Args>\n@@ -966,7 +965,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tnoexcept(is_nothrow_constructible_v<_Tp, const _Up&>)\n \t{\n \t  if (__t)\n-\t    emplace(__t._M_get());\n+\t    emplace(__t.operator*());\n \t}\n \n       template<typename _Up,\n@@ -979,7 +978,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tnoexcept(is_nothrow_constructible_v<_Tp, const _Up&>)\n \t{\n \t  if (__t)\n-\t    emplace(__t._M_get());\n+\t    emplace(__t.operator*());\n \t}\n \n       template<typename _Up,\n@@ -992,7 +991,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tnoexcept(is_nothrow_constructible_v<_Tp, _Up>)\n \t{\n \t  if (__t)\n-\t    emplace(std::move(__t._M_get()));\n+\t    emplace(std::move(__t).operator*());\n \t}\n \n       template<typename _Up,\n@@ -1005,7 +1004,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tnoexcept(is_nothrow_constructible_v<_Tp, _Up>)\n \t{\n \t  if (__t)\n-\t    emplace(std::move(__t._M_get()));\n+\t    emplace(std::move(__t).operator*());\n \t}\n \n       template<typename... _Args,\n@@ -1084,9 +1083,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t  if (__u)\n \t    {\n \t      if (this->_M_is_engaged())\n-\t\tthis->_M_get() = __u._M_get();\n+\t\tthis->_M_get() = __u.operator*();\n \t      else\n-\t\tthis->_M_construct(__u._M_get());\n+\t\tthis->_M_construct(__u.operator*());\n \t    }\n \t  else\n \t    {\n@@ -1118,9 +1117,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t  if (__u)\n \t    {\n \t      if (this->_M_is_engaged())\n-\t\tthis->_M_get() = std::move(__u._M_get());\n+\t\tthis->_M_get() = std::move(__u).operator*();\n \t      else\n-\t\tthis->_M_construct(std::move(__u._M_get()));\n+\t\tthis->_M_construct(std::move(__u).operator*());\n \t    }\n \t  else\n \t    {\n@@ -1320,7 +1319,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tand_then(_Fn&& __f) &\n \t{\n \t  using _Up = remove_cvref_t<invoke_result_t<_Fn, _Tp&>>;\n-\t  static_assert(__is_optional_v<remove_cvref_t<_Up>>,\n+\t  static_assert(__is_optional_v<_Up>,\n \t\t\t\"the function passed to std::optional<T>::and_then \"\n \t\t\t\"must return a std::optional\");\n \t  if (has_value())\n@@ -1348,7 +1347,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tand_then(_Fn&& __f) &&\n \t{\n \t  using _Up = remove_cvref_t<invoke_result_t<_Fn, _Tp>>;\n-\t  static_assert(__is_optional_v<remove_cvref_t<_Up>>,\n+\t  static_assert(__is_optional_v<_Up>,\n \t\t\t\"the function passed to std::optional<T>::and_then \"\n \t\t\t\"must return a std::optional\");\n \t  if (has_value())\n@@ -1362,7 +1361,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tand_then(_Fn&& __f) const &&\n \t{\n \t  using _Up = remove_cvref_t<invoke_result_t<_Fn, const _Tp>>;\n-\t  static_assert(__is_optional_v<remove_cvref_t<_Up>>,\n+\t  static_assert(__is_optional_v<_Up>,\n \t\t\t\"the function passed to std::optional<T>::and_then \"\n \t\t\t\"must return a std::optional\");\n \t  if (has_value())\n@@ -1376,10 +1375,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \ttransform(_Fn&& __f) &\n \t{\n \t  using _Up = remove_cv_t<invoke_result_t<_Fn, _Tp&>>;\n-\t  static_assert(__is_valid_contained_type_for_optional<_Up>,\n-\t\t\t\"the function passed to std::optional<T>::transform \"\n-\t\t\t\"must return a type \"\n-\t\t\t\"that can be stored inside std::optional\");\n \t  if (has_value())\n \t    return optional<_Up>(_Optional_func<_Fn>{__f}, _M_get());\n \t  else\n@@ -1391,10 +1386,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \ttransform(_Fn&& __f) const &\n \t{\n \t  using _Up = remove_cv_t<invoke_result_t<_Fn, const _Tp&>>;\n-\t  static_assert(__is_valid_contained_type_for_optional<_Up>,\n-\t\t\t\"the function passed to std::optional<T>::transform \"\n-\t\t\t\"must return a type \"\n-\t\t\t\"that can be stored inside std::optional\");\n \t  if (has_value())\n \t    return optional<_Up>(_Optional_func<_Fn>{__f}, _M_get());\n \t  else\n@@ -1406,10 +1397,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \ttransform(_Fn&& __f) &&\n \t{\n \t  using _Up = remove_cv_t<invoke_result_t<_Fn, _Tp>>;\n-\t  static_assert(__is_valid_contained_type_for_optional<_Up>,\n-\t\t\t\"the function passed to std::optional<T>::transform \"\n-\t\t\t\"must return a type \"\n-\t\t\t\"that can be stored inside std::optional\");\n \t  if (has_value())\n \t    return optional<_Up>(_Optional_func<_Fn>{__f}, std::move(_M_get()));\n \t  else\n@@ -1421,10 +1408,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \ttransform(_Fn&& __f) const &&\n \t{\n \t  using _Up = remove_cv_t<invoke_result_t<_Fn, const _Tp>>;\n-\t  static_assert(__is_valid_contained_type_for_optional<_Up>,\n-\t\t\t\"the function passed to std::optional<T>::transform \"\n-\t\t\t\"must return a type \"\n-\t\t\t\"that can be stored inside std::optional\");\n \t  if (has_value())\n \t    return optional<_Up>(_Optional_func<_Fn>{__f}, std::move(_M_get()));\n \t  else\n@@ -1537,7 +1520,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tnoexcept(is_nothrow_constructible_v<_Tp&, _Up&>)\n \t{\n \t  if (__rhs)\n-\t    __convert_ref_init_val(*__rhs);\n+\t    __convert_ref_init_val(__rhs.operator*());\n \t}\n \n       template<typename _Up>\n@@ -1561,7 +1544,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tnoexcept(is_nothrow_constructible_v<_Tp&, _Up&>)\n \t{\n \t  if (__rhs)\n-\t    __convert_ref_init_val(*__rhs);\n+\t    __convert_ref_init_val(__rhs.operator*());\n \t}\n \n       template<typename _Up>\n@@ -1585,7 +1568,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tnoexcept(is_nothrow_constructible_v<_Tp&, _Up>)\n \t{\n \t  if (__rhs)\n-\t    __convert_ref_init_val(*std::move(__rhs));\n+\t    __convert_ref_init_val(std::move(__rhs).operator*());\n \t}\n \n       template<typename _Up>\n@@ -1609,7 +1592,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tnoexcept(is_nothrow_constructible_v<_Tp&, const _Up>)\n \t{\n \t  if (__rhs)\n-\t    __convert_ref_init_val(*std::move(__rhs));\n+\t    __convert_ref_init_val(std::move(__rhs).operator*());\n \t}\n \n       template<typename _Up>\n@@ -1641,7 +1624,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tnoexcept(is_nothrow_constructible_v<_Tp&, _Up>)\n \t{\n \t  __convert_ref_init_val(std::forward<_Up>(__u));\n-\t  return *_M_val; // FIXME: this isn't specified in the paper as Returns:, but likely a typo? What else could it be?\n+\t  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n+\t  // 4300. Missing Returns: element in optional<T&>::emplace\n+\t  return *_M_val;\n \t}\n \n       // Swap.\n@@ -1691,8 +1676,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n         __throw_bad_optional_access();\n       }\n \n+      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n+      // 4304. std::optional<NonReturnable&> is ill-formed due to value_or\n       template<typename _Up = remove_cv_t<_Tp>>\n-\tconstexpr remove_cv_t<_Tp>\n+        requires (!is_array_v<_Tp>)\n+\tconstexpr decay_t<_Tp>\n \tvalue_or(_Up&& __u) const\n \t{\n           using _Xp = remove_cv_t<_Tp>;\n@@ -1706,28 +1694,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tconstexpr auto\n \tand_then(_Fn&& __f) const\n \t{\n-\t  using _Up = invoke_result_t<_Fn, _Tp&>;\n-\t  static_assert(__is_optional_v<remove_cvref_t<_Up>>,\n+\t  using _Up = remove_cvref_t<invoke_result_t<_Fn, _Tp&>>;\n+\t  static_assert(__is_optional_v<_Up>,\n \t\t\t\"the function passed to std::optional<T&>::and_then \"\n \t\t\t\"must return a std::optional\");\n \t  if (has_value())\n \t    return std::__invoke(std::forward<_Fn>(__f), *_M_val);\n \t  else\n-\t    return remove_cvref_t<_Up>();\n+\t    return _Up();\n \t}\n \n       template<typename _Fn>\n \tconstexpr\n-\toptional<remove_cv_t<invoke_result_t<_Fn, _Tp&>>> // TODO why is it spelled out in the paper instead of `auto`? Like the wording for the primary template\n+\toptional<remove_cv_t<invoke_result_t<_Fn, _Tp&>>>\n \ttransform(_Fn&& __f) const\n \t{\n \t  using _Up = remove_cv_t<invoke_result_t<_Fn, _Tp&>>;\n-\t  // FIXME not 100% sure yet how to express the Mandates here \"(The declaration U u(invoke(std::forward<F>(f), *val)); is well-formed for some invented variable u.)\".\n-\t  // TODO: It seems that this Mandates also missing from our implementation of the primary template...?\n-\n-\t  // FIXME why isn't there in the paper a Mandates that U is a valid contained type for optional? Like in the wording for the primary template.\n \t  if (has_value())\n-\t    return optional<_Up>(_Optional_func<_Fn>{__f}, *_M_val); // TODO the sample impl in the paper seems wrong, as that requires U to be movable (?). This is our primary's template impl which builds in place, and that seems like a better idea\n+\t    return optional<_Up>(_Optional_func<_Fn>{__f}, *_M_val);\n \t  else\n \t    return optional<_Up>();\n \t}\n@@ -1741,8 +1725,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t  static_assert(is_same_v<remove_cvref_t<invoke_result_t<_Fn>>, optional>,\n \t\t\t\"the function passed to std::optional<T&>::or_else \"\n \t\t\t\"must return a std::optional<T&>\");\n+\t  // _GLIBCXX_RESOLVE_LIB_DEFECTS \n+\t  // 4367. Improve optional<T&>::or_else\n \t  if (has_value())\n-\t    return *_M_val; // FIXME in the paper it's spelled like this. I'm not sure yet why it's not spelled `return *this`, like in the primary template's wording? Does this have implications on e.g. lifetime? Suppose one has an object T in some storage, creates an optional<T&> bound to that object, destroys the object, calls opt.or_else(). Is that UB because of the dereference or should it just copy the reference without accessing the (destroyed) object? Should it be UB? The object could be subsequently transparently replaced and the result of or_else bound to the new object...\n+\t    return *this;\n \t  else\n \t    return std::forward<_Fn>(__f)();\n \t}\n@@ -1755,6 +1741,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \n     private:\n       _Tp *_M_val = nullptr;\n+      \n+      template<typename _Up> friend class optional;\n \n       template<typename _Up>\n \tconstexpr\n@@ -1766,13 +1754,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t  _M_val = std::addressof(__r);\n \t}\n \n-      template<typename _Up> friend class optional;\n-\n       template<typename _Fn, typename _Value>\n \texplicit constexpr\n \toptional(_Optional_func<_Fn> __f, _Value&& __v)\n \t{\n-          // TODO: double check this\n \t  _Tp& __r = std::__invoke(std::forward<_Fn>(__f._M_f), std::forward<_Value>(__v));\n \t  _M_val = std::addressof(__r);\n \t}\n@@ -2057,30 +2042,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \n   // Swap and creation functions.\n \n-  template<typename _Tp>\n-    inline constexpr bool __is_optional_swappable =\n-#if __cpp_lib_optional >= 202506L\n-      is_reference_v<_Tp> ||\n-#endif\n-      (is_move_constructible_v<_Tp> && is_swappable_v<_Tp>);\n-\n   // _GLIBCXX_RESOLVE_LIB_DEFECTS\n   // 2748. swappable traits for optionals\n   template<typename _Tp>\n     _GLIBCXX20_CONSTEXPR\n-    inline enable_if_t<__is_optional_swappable<_Tp>>\n+    inline enable_if_t<is_move_constructible_v<_Tp> && is_swappable_v<_Tp>>\n     swap(optional<_Tp>& __lhs, optional<_Tp>& __rhs)\n     noexcept(noexcept(__lhs.swap(__rhs)))\n     { __lhs.swap(__rhs); }\n \n+#if __cpp_lib_optional >= 202506L\n+  template<typename _Tp>\n+    constexpr void\n+    swap(optional<_Tp&>& __lhs, optional<_Tp&>& __rhs) noexcept\n+    { __lhs.swap(__rhs); }\n+#endif\n+\n   // _GLIBCXX_RESOLVE_LIB_DEFECTS\n   // 2766. Swapping non-swappable types\n   template<typename _Tp>\n-    enable_if_t<!__is_optional_swappable<_Tp>>\n+    enable_if_t<!(is_move_constructible_v<_Tp> && is_swappable_v<_Tp>)>\n     swap(optional<_Tp>&, optional<_Tp>&) = delete;\n \n-#if __cpp_lib_optional >= 202506L && 0 // FIXME. This change breaks make_optional<T>({braced init list}). Wanted?\n-  template<TODO> // \"Constraints: The call to make_optional does not use an explicit template-argument-list that begins with a type template-argument\"\n+#if __cpp_lib_optional >= 202506L\n+  template<int = 0, typename _Tp>\n #else\n   template<typename _Tp>\n #endif\n",
    "prefixes": [
        "v1",
        "02/13"
    ]
}