Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2219043/?format=api
{ "id": 2219043, "url": "http://patchwork.ozlabs.org/api/patches/2219043/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260402104238.340807-1-tkaminsk@redhat.com/", "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": "<20260402104238.340807-1-tkaminsk@redhat.com>", "list_archive_url": null, "date": "2026-04-02T10:41:32", "name": "libstdc++: Updated inplace_vector::try_ functions per P3981R2 and P4022R0.", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "e6c899a65fe994f0e51df462f7c8a4753d9e3fd0", "submitter": { "id": 90409, "url": "http://patchwork.ozlabs.org/api/people/90409/?format=api", "name": "Tomasz Kaminski", "email": "tkaminsk@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260402104238.340807-1-tkaminsk@redhat.com/mbox/", "series": [ { "id": 498467, "url": "http://patchwork.ozlabs.org/api/series/498467/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=498467", "date": "2026-04-02T10:41:32", "name": "libstdc++: Updated inplace_vector::try_ functions per P3981R2 and P4022R0.", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/498467/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2219043/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2219043/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=ilXJcuZ6;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.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=ilXJcuZ6", "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 [38.145.34.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 4fmdkC68fdz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 02 Apr 2026 21:43:31 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 5FAB94BA23CE\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 2 Apr 2026 10:43:29 +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 456384BA23C3\n for <gcc-patches@gcc.gnu.org>; Thu, 2 Apr 2026 10:42:44 +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-513-MpK0oNcOMo2IJUnVTKFTqQ-1; Thu,\n 02 Apr 2026 06:42:41 -0400", "from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\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 D24511956050; Thu, 2 Apr 2026 10:42:40 +0000 (UTC)", "from localhost (unknown [10.44.48.231])\n by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 11B761955D6C; Thu, 2 Apr 2026 10:42:39 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 5FAB94BA23CE", "OpenDKIM Filter v2.11.0 sourceware.org 456384BA23C3" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 456384BA23C3", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 456384BA23C3", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775126564; cv=none;\n b=utuikaQM9Gz04n8AuXHJL+ZdM46ktmpc6UQLtK7v69fnb70VDJXNr+FmXTL4/XSWOCCcc+2z85rsp/Dw8eX3Yn+S5/AtMNFfffJFHsCccEy5WM7B08EbI+cLwBBKShutkktDkFRoX5fmLYCXmhBs8l4uhV690chhVJboEbuLiuE=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1775126564; c=relaxed/simple;\n bh=DsCkzKAmLRxTSjOQpGLbVHyBcW5NS6HBB8B+wTpUXTU=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=BonSQrddBWEuFSJGp0H31TIMiLdi3wK8MfIyahRcO9yY/uLrm+0EF6SFgmY04Sd12AXP428vzCFLOij273ZNhbvx6MjfPGzRldEaPzbrGY2ZNaE6YAVpqIEWWzboviO1aWL+lIKPHn3tUrpnhxUN9e75zvZ6UecDWzieqdZUqGs=", "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=1775126563;\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=NR2wqtYdmoZR1wW86XVXH/7mltoyG4eBtLRhHHZdQi0=;\n b=ilXJcuZ6wwjHOUJnqh55zJ25MqucE2L1nkrfpVetXiVYQ064RT+CREnqpxBGFktVlPiESj\n nb8tHPJif1NYh9MdNQAlSIDLOahsHMDCXFUlPBB7sythq2X9pHyalnU2X26YdRZSfskOEO\n RRo0x0BQINxaQthWawQ/O8oOpeeCfTU=", "X-MC-Unique": "MpK0oNcOMo2IJUnVTKFTqQ-1", "X-Mimecast-MFC-AGG-ID": "MpK0oNcOMo2IJUnVTKFTqQ_1775126561", "From": "=?utf-8?q?Tomasz_Kami=C5=84ski?= <tkaminsk@redhat.com>", "To": "libstdc++@gcc.gnu.org,\n\tgcc-patches@gcc.gnu.org", "Subject": "[PATCH] libstdc++: Updated inplace_vector::try_ functions per P3981R2\n and P4022R0.", "Date": "Thu, 2 Apr 2026 12:41:32 +0200", "Message-ID": "<20260402104238.340807-1-tkaminsk@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.12", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "qT0TZ6aFX-aWWpdIG3P-iWTn9cO5pV79Q7bc_2FTgKs_1775126561", "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": "This paper removes the try_append_range from inplace_vector and changes the\nreturn type of try_emplace_back and try_push_back to optional<_Tp&> per:\nP4022R0: Remove try_append_range from inplace_vector for now.\nP3981R2: Better return types in std::inplace_vector and std::exception_ptr_cast.\n\nThe test are also expanded to cover type Y, that is convertible to optional<Y&>,\nand require return type to be constructed using in_place.\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/version.def (inplace_vector): Bump to 202603.\n\t* include/bits/version.h: Regenerate.\n\t* include/std/inplace_vector (inplace_vector::try_emplace_back)\n\t(inplace_vector::try_push_back): Change return type to optional<_Tp&>\n\tand adjust implementation accordingly.\n\t(inplace_vector::try_append_range): Remove.\n\t* include/debug/inplace_vector (inplace_vector::try_emplace_back)\n\t(inplace_vector::try_push_back, inplace_vector::try_append_range):\n\tLikewise.\n\t* testsuite/23_containers/inplace_vector/modifiers/single_insert.cc:\n\tUpdated check for the optional<T&> return. Added test for type\n\tconvertible to optional<T&>\n\t* testsuite/23_containers/inplace_vector/debug/invalidation/try_emplace_back.cc:\n\tUse has_value() to check if engaged optional is returned.\n\t* testsuite/23_containers/inplace_vector/debug/invalidation/try_push_back.cc:\n\tLikewise.\n\t* testsuite/23_containers/inplace_vector/modifiers/multi_insert.cc:\n\tRemove try_append_range tests.\n\t* testsuite/23_containers/inplace_vector/debug/invalidation/try_append_range.cc:\n\tRemoved.\n\t* testsuite/23_containers/inplace_vector/version.cc: Updated expected\n\tfeature test macro value.\n---\nThe exception_ptr change need to be handled seprately, due it being\ndefined in libsup++.\n\nTesting on x86_64-linux. All *inplace_vector* test already passed.\nOK for trunk if all test finishes?\n\n libstdc++-v3/include/bits/version.def | 5 +-\n libstdc++-v3/include/bits/version.h | 4 +-\n libstdc++-v3/include/debug/inplace_vector | 26 ++-----\n libstdc++-v3/include/std/inplace_vector | 70 +++++--------------\n .../debug/invalidation/try_append_range.cc | 45 ------------\n .../debug/invalidation/try_emplace_back.cc | 2 +-\n .../debug/invalidation/try_push_back.cc | 4 +-\n .../inplace_vector/modifiers/multi_insert.cc | 46 ------------\n .../inplace_vector/modifiers/single_insert.cc | 41 ++++++++---\n .../23_containers/inplace_vector/version.cc | 4 +-\n 10 files changed, 66 insertions(+), 181 deletions(-)\n delete mode 100644 libstdc++-v3/testsuite/23_containers/inplace_vector/debug/invalidation/try_append_range.cc", "diff": "diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def\nindex ada8da88bc5..998223306e2 100644\n--- a/libstdc++-v3/include/bits/version.def\n+++ b/libstdc++-v3/include/bits/version.def\n@@ -2223,9 +2223,12 @@ ftms = {\n };\n \n ftms = {\n+ // 202406 P0843R14 inplace_vector \n+ // 202603 P3981R2 Better return types in std::inplace_vector and std::exception_ptr_cast\n+ // P4022R0 Remove try_append_range from inplace_vector for now\n name = inplace_vector;\n values = {\n- v = 202406;\n+ v = 202603;\n cxxmin = 26;\n };\n };\ndiff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h\nindex 0490e79dd41..cb3b9b0997e 100644\n--- a/libstdc++-v3/include/bits/version.h\n+++ b/libstdc++-v3/include/bits/version.h\n@@ -2488,9 +2488,9 @@\n \n #if !defined(__cpp_lib_inplace_vector)\n # if (__cplusplus > 202302L)\n-# define __glibcxx_inplace_vector 202406L\n+# define __glibcxx_inplace_vector 202603L\n # if defined(__glibcxx_want_all) || defined(__glibcxx_want_inplace_vector)\n-# define __cpp_lib_inplace_vector 202406L\n+# define __cpp_lib_inplace_vector 202603L\n # endif\n # endif\n #endif /* !defined(__cpp_lib_inplace_vector) */\ndiff --git a/libstdc++-v3/include/debug/inplace_vector b/libstdc++-v3/include/debug/inplace_vector\nindex 750b0a7343c..e579e8636f9 100644\n--- a/libstdc++-v3/include/debug/inplace_vector\n+++ b/libstdc++-v3/include/debug/inplace_vector\n@@ -338,11 +338,12 @@ namespace __debug\n }\n \n template<typename... _Args>\n-\tconstexpr _Tp*\n+\tconstexpr optional<_Tp&>\n \ttry_emplace_back(_Args&&... __args)\n \t{\n \t auto __end = _Base::cend();\n-\t _Tp* __res = _Base::try_emplace_back(std::forward<_Args>(__args)...);\n+\t optional<_Tp&> __res\n+\t = _Base::try_emplace_back(std::forward<_Args>(__args)...);\n \n \t if (__res)\n \t this->_M_invalidate_if(_Equal(__end));\n@@ -350,11 +351,11 @@ namespace __debug\n \t return __res;\n \t}\n \n- constexpr _Tp*\n+ constexpr optional<_Tp&>\n try_push_back(const _Tp& __x)\n {\n \tconst auto __end = _Base::cend();\n-\t_Tp* __res = _Base::try_push_back(__x);\n+\toptional<_Tp&> __res = _Base::try_push_back(__x);\n \n \tif (__res)\n \t this->_M_invalidate_if(_Equal(__end));\n@@ -362,11 +363,11 @@ namespace __debug\n \treturn __res;\n }\n \n- constexpr _Tp*\n+ constexpr optional<_Tp&>\n try_push_back(_Tp&& __x)\n {\n \tconst auto __end = _Base::cend();\n-\t_Tp* __res = _Base::try_push_back(std::move(__x));\n+\toptional<_Tp&> __res = _Base::try_push_back(std::move(__x));\n \n \tif (__res)\n \t this->_M_invalidate_if(_Equal(__end));\n@@ -374,19 +375,6 @@ namespace __debug\n \treturn __res;\n }\n \n- template<__detail::__container_compatible_range<_Tp> _Rg>\n-\tconstexpr ranges::borrowed_iterator_t<_Rg>\n-\ttry_append_range(_Rg&& __rg)\n-\t{\n-\t const auto __size = size();\n-\t const auto __end = _Base::cend();\n-\t auto __res = _Base::try_append_range(__rg);\n-\t if (size() != __size)\n-\t this->_M_invalidate_if(_Equal(__end));\n-\n-\t return __res;\n-\t}\n-\n template<typename... _Args>\n \tconstexpr _Tp&\n \tunchecked_emplace_back(_Args&&... __args)\ndiff --git a/libstdc++-v3/include/std/inplace_vector b/libstdc++-v3/include/std/inplace_vector\nindex c22a9e1f9b4..5ad92332a02 100644\n--- a/libstdc++-v3/include/std/inplace_vector\n+++ b/libstdc++-v3/include/std/inplace_vector\n@@ -38,6 +38,7 @@\n #ifdef __glibcxx_inplace_vector // C++ >= 26\n #include <compare>\n #include <initializer_list>\n+#include <optional>\n #include <bits/stdexcept_throw.h>\n #include <bits/range_access.h>\n #include <bits/ranges_base.h> // borrowed_iterator_t, __detail::__container_compatible_range\n@@ -550,63 +551,31 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER\n }\n \n template<typename... _Args>\n-\tconstexpr _Tp*\n+\tconstexpr optional<_Tp&>\n \ttry_emplace_back(_Args&&... __args)\n \t{\n \t if (_M_size >= _Nm) [[unlikely]]\n-\t return nullptr;\n-\t auto& __r = unchecked_emplace_back(std::forward<_Args>(__args)...);\n-\t return __builtin_addressof(__r);\n+\t return nullopt;\n+\t return optional<_Tp&>(in_place,\n+\t\t unchecked_emplace_back(std::forward<_Args>(__args)...));\n \t}\n \n- constexpr _Tp*\n+ constexpr optional<_Tp&>\n try_push_back(const _Tp& __x)\n {\n \tif (_M_size >= _Nm) [[unlikely]]\n-\t return nullptr;\n-\treturn __builtin_addressof(unchecked_emplace_back(__x));\n+\t return nullopt;\n+\treturn optional<_Tp&>(in_place, unchecked_emplace_back(__x));\n }\n \n- constexpr _Tp*\n+ constexpr optional<_Tp&>\n try_push_back(_Tp&& __x)\n {\n \tif (_M_size >= _Nm) [[unlikely]]\n-\t return nullptr;\n-\treturn __builtin_addressof(unchecked_emplace_back(std::move(__x)));\n+\t return nullopt;\n+\treturn optional<_Tp&>(in_place, unchecked_emplace_back(std::move(__x)));\n }\n \n- template<__detail::__container_compatible_range<_Tp> _Rg>\n-\tconstexpr ranges::borrowed_iterator_t<_Rg>\n-\ttry_append_range(_Rg&& __rg)\n-\t{\n-\t if constexpr (ranges::sized_range<_Rg>)\n-\t {\n-\t auto __n = ranges::distance(__rg);\n-\t if (__n == 0) [[unlikely]]\n-\t\treturn ranges::begin(__rg);\n-\n-\t const auto __end = data() + _M_size;\n-\t const size_t __avail = _Nm - size();\n-\t if (__n <= __avail)\n-\t\t_M_size += size_type(__n);\n-\t else\n-\t\t{\n-\t\t __n = __avail;\n-\t\t _M_size = _Nm;\n-\t\t}\n-\t return ranges::uninitialized_copy_n(\n-\t\t ranges::begin(__rg), __n,\n-\t\t __end, unreachable_sentinel).in;\n-\t }\n-\t else\n-\t {\n-\t ranges::subrange<pointer> __tail(data() + _M_size, data() + _Nm);\n-\t auto [__in, __out] = ranges::uninitialized_copy(__rg, __tail);\n-\t _M_size = __out - data();\n-\t return std::move(__in);\n-\t }\n-\t}\n-\n template<typename... _Args>\n \tconstexpr _Tp&\n \tunchecked_emplace_back(_Args&&... __args)\n@@ -1208,22 +1177,17 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER\n { __builtin_trap(); }\n \n template<typename... _Args>\n-\tconstexpr _Tp*\n+ constexpr optional<_Tp&>\n \ttry_emplace_back(_Args&&...)\n-\t{ return nullptr; }\n+\t{ return nullopt; }\n \n- constexpr _Tp*\n+ constexpr optional<_Tp&>\n try_push_back(const _Tp&)\n- { return nullptr; }\n+ { return nullopt; }\n \n- constexpr _Tp*\n+ constexpr optional<_Tp&>\n try_push_back(_Tp&&)\n- { return nullptr; }\n-\n- template<__detail::__container_compatible_range<_Tp> _Rg>\n-\tconstexpr ranges::borrowed_iterator_t<_Rg>\n-\ttry_append_range(_Rg&& __rg)\n-\t{ return ranges::begin(__rg); }\n+ { return nullopt; }\n \n template<typename... _Args>\n \t[[noreturn]]\ndiff --git a/libstdc++-v3/testsuite/23_containers/inplace_vector/debug/invalidation/try_append_range.cc b/libstdc++-v3/testsuite/23_containers/inplace_vector/debug/invalidation/try_append_range.cc\ndeleted file mode 100644\nindex ae4ac418f50..00000000000\n--- a/libstdc++-v3/testsuite/23_containers/inplace_vector/debug/invalidation/try_append_range.cc\n+++ /dev/null\n@@ -1,45 +0,0 @@\n-// { dg-do run { target c++26 } }\n-\n-#include <debug/inplace_vector>\n-#include <testsuite_hooks.h>\n-\n-using __gnu_debug::inplace_vector;\n-\n-void test01()\n-{\n- inplace_vector<int, 100> v(10, 17);\n- inplace_vector<int, 10> v1(10, 19);\n-\n- auto before = v.begin() + 6;\n- auto last = v.end();\n- auto end = last--;\n-\n- v.try_append_range(v1);\n-\n- VERIFY(before._M_dereferenceable());\n- VERIFY(last._M_dereferenceable());\n- VERIFY(end._M_singular());\n-}\n-\n-void test02()\n-{\n- inplace_vector<int, 100> v(10, 17);\n- inplace_vector<int, 0> v1;\n-\n- auto before = v.begin() + 6;\n- auto last = v.end();\n- auto end = last--;\n-\n- v.try_append_range(v1);\n-\n- VERIFY(before._M_dereferenceable());\n- VERIFY(last._M_dereferenceable());\n- VERIFY(!end._M_singular());\n-}\n-\n-int main()\n-{\n- test01();\n- test02();\n- return 0;\n-}\ndiff --git a/libstdc++-v3/testsuite/23_containers/inplace_vector/debug/invalidation/try_emplace_back.cc b/libstdc++-v3/testsuite/23_containers/inplace_vector/debug/invalidation/try_emplace_back.cc\nindex f7c8c7a9ba2..606d478a0dc 100644\n--- a/libstdc++-v3/testsuite/23_containers/inplace_vector/debug/invalidation/try_emplace_back.cc\n+++ b/libstdc++-v3/testsuite/23_containers/inplace_vector/debug/invalidation/try_emplace_back.cc\n@@ -13,7 +13,7 @@ void test01()\n auto last = v.end();\n auto end = last--;\n \n- VERIFY( v.try_emplace_back(42) != nullptr );\n+ VERIFY( v.try_emplace_back(42).has_value() );\n \n VERIFY(before._M_dereferenceable());\n VERIFY(last._M_dereferenceable());\ndiff --git a/libstdc++-v3/testsuite/23_containers/inplace_vector/debug/invalidation/try_push_back.cc b/libstdc++-v3/testsuite/23_containers/inplace_vector/debug/invalidation/try_push_back.cc\nindex 04fc010e500..96af2b65b72 100644\n--- a/libstdc++-v3/testsuite/23_containers/inplace_vector/debug/invalidation/try_push_back.cc\n+++ b/libstdc++-v3/testsuite/23_containers/inplace_vector/debug/invalidation/try_push_back.cc\n@@ -14,7 +14,7 @@ void test01()\n auto last = v.end();\n auto end = last--;\n \n- VERIFY( v.try_push_back(42) != nullptr );\n+ VERIFY( v.try_push_back(42).has_value() );\n \n VERIFY(before._M_dereferenceable());\n VERIFY(last._M_dereferenceable());\n@@ -30,7 +30,7 @@ void test02()\n auto last = v.end();\n auto end = last--;\n \n- VERIFY( v.try_push_back(std::move(vv)) != nullptr );\n+ VERIFY( v.try_push_back(std::move(vv)).has_value() );\n \n VERIFY(before._M_dereferenceable());\n VERIFY(last._M_dereferenceable());\ndiff --git a/libstdc++-v3/testsuite/23_containers/inplace_vector/modifiers/multi_insert.cc b/libstdc++-v3/testsuite/23_containers/inplace_vector/modifiers/multi_insert.cc\nindex 454163892ad..e5a482cdc65 100644\n--- a/libstdc++-v3/testsuite/23_containers/inplace_vector/modifiers/multi_insert.cc\n+++ b/libstdc++-v3/testsuite/23_containers/inplace_vector/modifiers/multi_insert.cc\n@@ -54,16 +54,6 @@ test_add_to_full_it()\n \n std::inplace_vector<T, N> v(std::from_range, std::span(a, a+N));\n \n- Range r1(a, a);\n- auto rit1 = v.try_append_range(r1);\n- VERIFY( eq<T>(v, {a, N}) );\n- VERIFY( rit1.base() == a );\n-\n- SizedRange r2(a, a);\n- auto rit2 = v.try_append_range(r2);\n- VERIFY( eq<T>(v, {a, N}) );\n- VERIFY( rit2.base() == a );\n-\n v.append_range(Range(a, a));\n VERIFY( eq<T>(v, {a, N}) );\n v.append_range(SizedRange(a, a));\n@@ -93,17 +83,6 @@ test_add_to_full_it()\n VERIFY( eq<T>(v, {a, N}) );\n VERIFY( it == v.begin() );\n \n- // Inserting non-empty range\n- Range r3(a+3, a+5);\n- auto rit3 = v.try_append_range(r3);\n- VERIFY( eq<T>(v, {a, N}) );\n- VERIFY( rit3.base() == a+3 );\n-\n- SizedRange r4(a+2, a+5);\n- auto rit4 = v.try_append_range(r4);\n- VERIFY( eq<T>(v, {a, N}) );\n- VERIFY( rit4.base() == a+2 );\n-\n #ifdef __cpp_exceptions\n #ifndef __cpp_lib_constexpr_exceptions\n if consteval {\n@@ -265,30 +244,6 @@ test_append_range()\n #endif\n }\n \n-template<typename Range>\n-constexpr void\n-test_try_append_range()\n-{\n- using T = std::ranges::range_value_t<Range>;\n- T a[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25};\n-\n- std::inplace_vector<T, 20> v;\n- Range r1 = Range(a, a+10);\n- auto it1 = v.try_append_range(r1);\n- VERIFY( eq<T>(v, {a, 10}) );\n- VERIFY( it1.base() == a+10 );\n-\n- Range r2 = Range(a+10, a+15);\n- auto it2 = v.try_append_range(r2);\n- VERIFY( eq<T>(v, {a, 15}) );\n- VERIFY( it2.base() == a+15 );\n-\n- Range r3 = Range(a+15, a+25);\n- auto it3 = v.try_append_range(r3);\n- VERIFY( eq<T>(v, {a, 20}) );\n- VERIFY( it3.base() == a+20 );\n-}\n-\n template<typename Range>\n constexpr void\n test_insert_range()\n@@ -357,7 +312,6 @@ constexpr void\n do_test_ranges()\n {\n test_append_range<Range>();\n- test_try_append_range<Range>();\n test_insert_range<Range>();\n }\n \ndiff --git a/libstdc++-v3/testsuite/23_containers/inplace_vector/modifiers/single_insert.cc b/libstdc++-v3/testsuite/23_containers/inplace_vector/modifiers/single_insert.cc\nindex 92bd765982e..245af928800 100644\n--- a/libstdc++-v3/testsuite/23_containers/inplace_vector/modifiers/single_insert.cc\n+++ b/libstdc++-v3/testsuite/23_containers/inplace_vector/modifiers/single_insert.cc\n@@ -3,6 +3,7 @@\n #include <inplace_vector>\n \n #include <span>\n+#include <optional>\n #include <testsuite_hooks.h>\n \n struct X\n@@ -18,6 +19,20 @@ struct X\n friend auto operator<=>(const X&, const X&) = default;\n };\n \n+// Type that is convertible to optional<Y&>\n+struct Y\n+{\n+ Y() = default;\n+ constexpr Y(int p) : v(p) {}\n+ \n+ constexpr operator std::optional<Y&>()\n+ { return std::nullopt; }\n+\n+ int v;\n+\n+ friend auto operator<=>(const Y&, const Y&) = default;\n+};\n+\n template<typename T, typename V, size_t N>\n constexpr bool\n eq(const std::inplace_vector<V, N>& l, std::span<const T> r) {\n@@ -40,11 +55,11 @@ test_add_to_full()\n \n std::inplace_vector<T, N> v(std::from_range, std::span(a, a+N));\n \n- VERIFY( v.try_emplace_back(1) == nullptr );\n+ VERIFY( !v.try_emplace_back(1).has_value() );\n VERIFY( eq<T>(v, {a, N}) );\n- VERIFY( v.try_push_back(T(1)) == nullptr );\n+ VERIFY( !v.try_push_back(T(1)).has_value() );\n VERIFY( eq<T>(v, {a, N}) );\n- VERIFY( v.try_push_back(c) == nullptr );\n+ VERIFY( !v.try_push_back(c).has_value() );\n VERIFY( eq<T>(v, {a, N}) );\n \n #ifdef __cpp_exceptions\n@@ -149,15 +164,18 @@ test_inserts()\n v.unchecked_push_back(c);\n VERIFY( eq<T>(v, {a+3, 6}) );\n \n- T* ptr = v.try_emplace_back(7);\n+ std::optional<T&> opt = v.try_emplace_back(7);\n VERIFY( eq<T>(v, {a+3, 7}) );\n- VERIFY( ptr = &v.back() );\n- ptr = v.try_push_back(T(8));\n+ VERIFY( opt.has_value() );\n+ VERIFY( &*opt == &v.back() );\n+ opt = v.try_push_back(T(8));\n VERIFY( eq<T>(v, {a+3, 8}) );\n- VERIFY( ptr = &v.back() );\n- ptr = v.try_push_back(c);\n+ VERIFY( opt.has_value() );\n+ VERIFY( &*opt == &v.back() );\n+ opt = v.try_push_back(c);\n VERIFY( eq<T>(v, {a+3, 9}) );\n- VERIFY( ptr = &v.back() );\n+ VERIFY( opt.has_value() );\n+ VERIFY( &*opt == &v.back() );\n \n auto it = v.emplace(v.end(), 10);\n VERIFY( eq<T>(v, {a+3, 10}) );\n@@ -195,12 +213,15 @@ int main()\n auto test_all = [] {\n test_add_to_full<0, int>();\n test_add_to_full<0, X>();\n+ test_add_to_full<0, Y>();\n \n test_add_to_full<4, int>();\n+ test_add_to_full<4, Y>();\n \n test_inserts<int>();\n+ test_inserts<Y>();\n #ifdef __cpp_lib_constexpr_inplace_vector\n-#error uncomemnt test_inserts<X>()\n+#error enable tests bellow\n #endif\n if ! consteval {\n test_add_to_full<4, X>();\ndiff --git a/libstdc++-v3/testsuite/23_containers/inplace_vector/version.cc b/libstdc++-v3/testsuite/23_containers/inplace_vector/version.cc\nindex a5bbdb8464b..493e86dc6dd 100644\n--- a/libstdc++-v3/testsuite/23_containers/inplace_vector/version.cc\n+++ b/libstdc++-v3/testsuite/23_containers/inplace_vector/version.cc\n@@ -5,7 +5,7 @@\n \n #ifndef __cpp_lib_inplace_vector\n # error \"Feature-test macro for inplace_vector missing in <inplace_vector>\"\n-#elif __cpp_lib_inplace_vector != 202406L\n+#elif __cpp_lib_inplace_vector != 202603L\n # error \"Feature-test macro for inplace_vector has wrong value in <inplace_vector>\"\n #endif\n \n@@ -15,6 +15,6 @@\n \n #ifndef __cpp_lib_inplace_vector\n # error \"Feature-test macro for inplace_vector missing in <version>\"\n-#elif __cpp_lib_inplace_vector != 202406L\n+#elif __cpp_lib_inplace_vector != 202603L\n # error \"Feature-test macro for inplace_vector has wrong value in <version>\"\n #endif\n", "prefixes": [] }