{"id":2221504,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2221504/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260409152207.515172-1-tkaminsk@redhat.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/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":"<20260409152207.515172-1-tkaminsk@redhat.com>","list_archive_url":null,"date":"2026-04-09T15:04:11","name":"libstdc++: Add default template parameters for uninitialized_fill(_n).","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"36d3e184b040428d942062c9326a1061a976dc10","submitter":{"id":90409,"url":"http://patchwork.ozlabs.org/api/1.2/people/90409/?format=json","name":"Tomasz Kaminski","email":"tkaminsk@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260409152207.515172-1-tkaminsk@redhat.com/mbox/","series":[{"id":499315,"url":"http://patchwork.ozlabs.org/api/1.2/series/499315/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=499315","date":"2026-04-09T15:04:11","name":"libstdc++: Add default template parameters for uninitialized_fill(_n).","version":1,"mbox":"http://patchwork.ozlabs.org/series/499315/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2221504/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2221504/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=fVDJPWhu;\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=fVDJPWhu","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 4fs3bv0M92z1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 01:23:21 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 724F54BA2E26\n\tfor <incoming@patchwork.ozlabs.org>; Thu,  9 Apr 2026 15:23:19 +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 A3EB54BA2E1F\n for <gcc-patches@gcc.gnu.org>; Thu,  9 Apr 2026 15:22:15 +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-536-njdpvl0tMQ-9RSk5hxpiPA-1; Thu,\n 09 Apr 2026 11:22:11 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id C4BB11955DB5; Thu,  9 Apr 2026 15:22:09 +0000 (UTC)","from localhost (unknown [10.44.33.240])\n by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 07B331800357; Thu,  9 Apr 2026 15:22:08 +0000 (UTC)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 724F54BA2E26","OpenDKIM Filter v2.11.0 sourceware.org A3EB54BA2E1F"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org A3EB54BA2E1F","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org A3EB54BA2E1F","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775748135; cv=none;\n b=nzDACWATHWYmaoleDVxeBPx2fb+b1hrMkmE7fxQicVoQrBlM9WCRoouo5+hQK5t2DV+of7jD6/s+Z3By5rswfM1j3lSycWzxlNzFY+udMFcTNcHqUqVKdZaXcda6OLwo6Toj8WWuawGXpdk6ZppRmfS7BEber7wx0zewZeyeAd8=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1775748135; c=relaxed/simple;\n bh=d+U1fSnRun10bJDNHUKqHF1nJdcxn5xgjcnOePEZtMc=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=tjocSN3zQlagwOFy0A+1P5GI7NvlAekbXYWLXfa/yYd7UxIIZQtik/Cm5N1/fc5VLOkn7eKDxn/u4d2PvEDuJxxg9U3Y0dnQUiRmY78GHc1vSFw3odiaPHwyXLViDwDGsZDgaJTvoMhrWnpPGDbJTqXeMozLu1GhD+oWMDsEgJk=","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=1775748135;\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=iPnrQaWqPABoLiYC+/bKRCFadJaXUF+eVB7AUzi8Ls8=;\n b=fVDJPWhuOabolIxr5IW6RPSQB2uchuC60dcnNKQNm3D3HJJEzGOBBsna2vU3nN7iq2/E0x\n QA1K6tcCnOwAfX5QRNLh1XM+jlU8Yzqbd+I/TxblgXPFBu5QiI8Qg4kQDjMqQ4b6Ju1D2F\n FD127M0/sNIdKBKmLa4OCfgLYozCZKY=","X-MC-Unique":"njdpvl0tMQ-9RSk5hxpiPA-1","X-Mimecast-MFC-AGG-ID":"njdpvl0tMQ-9RSk5hxpiPA_1775748130","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++: Add default template parameters for\n uninitialized_fill(_n).","Date":"Thu,  9 Apr 2026 17:04:11 +0200","Message-ID":"<20260409152207.515172-1-tkaminsk@redhat.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":"z3Xd9c4ENwTArWm7bagMuZOYzd3vQu9HKKrotIRng_A_1775748130","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 implements P3217R0 and adds default argument for the value type\ntemplater parameter for uninitialized_fill, uninitialized_fill_n and\ntheir ranges counterpart.\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/ranges_uninitialized.h\n\t(__uninitialized_fill_fn::operator())\n\t(__uninitialized_fill_fn_n::operator()): Add default argument\n\tfor _Tp parameter.\n\t* include/bits/stl_uninitialized.h (std::unitialized_fill)\n\t(std::unitialized_fill_n): Likewise.\n\t* include/pstl/glue_memory_defs.h (std::unitialized_fill)\n\t(std::unitialized_fill_n): Likewise.\n\t* include/bits/version.def (algorithm_default_value_type):\n\tBump to 202603.\n\t* include/bits/version.h: Regenerate.\n\t* testsuite/25_algorithms/default_template_value.cc:\n\tTest for new algorithms.\n---\n\nTested lightly locally, the default_template_value.cc passes.\nTesting on x86_64-linux. OK for trunk when all test passes?\n\n libstdc++-v3/include/bits/ranges_uninitialized.h  |  9 ++++++---\n libstdc++-v3/include/bits/stl_uninitialized.h     |  6 ++++--\n libstdc++-v3/include/bits/version.def             |  5 ++++-\n libstdc++-v3/include/bits/version.h               |  4 ++--\n libstdc++-v3/include/pstl/glue_memory_defs.h      |  5 +++--\n .../25_algorithms/default_template_value.cc       | 15 ++++++++++++++-\n 6 files changed, 33 insertions(+), 11 deletions(-)","diff":"diff --git a/libstdc++-v3/include/bits/ranges_uninitialized.h b/libstdc++-v3/include/bits/ranges_uninitialized.h\nindex 6e307ea43c6..f7845abd3f3 100644\n--- a/libstdc++-v3/include/bits/ranges_uninitialized.h\n+++ b/libstdc++-v3/include/bits/ranges_uninitialized.h\n@@ -458,7 +458,8 @@ namespace ranges\n   struct __uninitialized_fill_fn\n   {\n     template<__detail::__nothrow_forward_iterator _Iter,\n-\t     __detail::__nothrow_sentinel<_Iter> _Sent, typename _Tp>\n+\t     __detail::__nothrow_sentinel<_Iter> _Sent,\n+\t     typename _Tp _GLIBCXX26_DEF_VAL_T(iter_value_t<_Iter>)>\n       requires constructible_from<iter_value_t<_Iter>, const _Tp&>\n       _GLIBCXX26_CONSTEXPR\n       _Iter\n@@ -478,7 +479,8 @@ namespace ranges\n \t  }\n       }\n \n-    template<__detail::__nothrow_forward_range _Range, typename _Tp>\n+    template<__detail::__nothrow_forward_range _Range,\n+\t     typename _Tp _GLIBCXX26_DEF_VAL_T(range_value_t<_Range>)>\n       requires constructible_from<range_value_t<_Range>, const _Tp&>\n       _GLIBCXX26_CONSTEXPR\n       borrowed_iterator_t<_Range>\n@@ -492,7 +494,8 @@ namespace ranges\n \n   struct __uninitialized_fill_n_fn\n   {\n-    template<__detail::__nothrow_forward_iterator _Iter, typename _Tp>\n+    template<__detail::__nothrow_forward_iterator _Iter,\n+\t     typename _Tp _GLIBCXX26_DEF_VAL_T(iter_value_t<_Iter>)>\n       requires constructible_from<iter_value_t<_Iter>, const _Tp&>\n       _GLIBCXX26_CONSTEXPR\n       _Iter\ndiff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h\nindex 1c1fcfd62a4..ae4442f3858 100644\n--- a/libstdc++-v3/include/bits/stl_uninitialized.h\n+++ b/libstdc++-v3/include/bits/stl_uninitialized.h\n@@ -406,7 +406,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n    *\n    *  Like std::fill, but does not require an initialized output range.\n   */\n-  template<typename _ForwardIterator, typename _Tp>\n+  template<typename _ForwardIterator,\n+\t   typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_ForwardIterator)>\n     _GLIBCXX26_CONSTEXPR\n     inline void\n     uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last,\n@@ -542,7 +543,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n    *\n    *  Like std::fill_n, but does not require an initialized output range.\n   */\n-  template<typename _ForwardIterator, typename _Size, typename _Tp>\n+  template<typename _ForwardIterator, typename _Size,\n+\t   typename _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_ForwardIterator)>\n     _GLIBCXX26_CONSTEXPR\n     inline _ForwardIterator\n     uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)\ndiff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def\nindex cfb90533ce4..9a3b3655974 100644\n--- a/libstdc++-v3/include/bits/version.def\n+++ b/libstdc++-v3/include/bits/version.def\n@@ -2086,8 +2086,11 @@ ftms = {\n \n ftms = {\n   name = algorithm_default_value_type;\n+  // 202403 P2248R8 Enabling list-initialization for algorithms\n+  //        P3787R2 Adjoints to \"Enabling ...\": find_last\n+  // 202603 P3787R2 Adjoints to \"Enabling ...\": uninitialized_fill\n   values = {\n-    v = 202403;\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 22dd31b9d32..8f541fc389e 100644\n--- a/libstdc++-v3/include/bits/version.h\n+++ b/libstdc++-v3/include/bits/version.h\n@@ -2328,9 +2328,9 @@\n \n #if !defined(__cpp_lib_algorithm_default_value_type)\n # if (__cplusplus >  202302L)\n-#  define __glibcxx_algorithm_default_value_type 202403L\n+#  define __glibcxx_algorithm_default_value_type 202603L\n #  if defined(__glibcxx_want_all) || defined(__glibcxx_want_algorithm_default_value_type)\n-#   define __cpp_lib_algorithm_default_value_type 202403L\n+#   define __cpp_lib_algorithm_default_value_type 202603L\n #  endif\n # endif\n #endif /* !defined(__cpp_lib_algorithm_default_value_type) */\ndiff --git a/libstdc++-v3/include/pstl/glue_memory_defs.h b/libstdc++-v3/include/pstl/glue_memory_defs.h\nindex 6729319a51b..2eb4e5dca6b 100644\n--- a/libstdc++-v3/include/pstl/glue_memory_defs.h\n+++ b/libstdc++-v3/include/pstl/glue_memory_defs.h\n@@ -10,6 +10,7 @@\n #ifndef _PSTL_GLUE_MEMORY_DEFS_H\n #define _PSTL_GLUE_MEMORY_DEFS_H\n \n+#include <bits/stl_iterator_base_types.h>\n #include \"execution_defs.h\"\n \n namespace std\n@@ -37,11 +38,11 @@ uninitialized_move_n(_ExecutionPolicy&& __exec, _InputIterator __first, _Size __\n \n // [uninitialized.fill]\n \n-template <class _ExecutionPolicy, class _ForwardIterator, class _Tp>\n+template <class _ExecutionPolicy, class _ForwardIterator, class _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_ForwardIterator)>\n __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void>\n uninitialized_fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);\n \n-template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Tp>\n+template <class _ExecutionPolicy, class _ForwardIterator, class _Size, class _Tp _GLIBCXX26_ALGO_DEF_VAL_T(_ForwardIterator)>\n __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator>\n uninitialized_fill_n(_ExecutionPolicy&& __exec, _ForwardIterator __first, _Size __n, const _Tp& __value);\n \ndiff --git a/libstdc++-v3/testsuite/25_algorithms/default_template_value.cc b/libstdc++-v3/testsuite/25_algorithms/default_template_value.cc\nindex b05234e1f8d..60f3d95ddb3 100644\n--- a/libstdc++-v3/testsuite/25_algorithms/default_template_value.cc\n+++ b/libstdc++-v3/testsuite/25_algorithms/default_template_value.cc\n@@ -4,12 +4,14 @@\n \n #if !defined(__cpp_lib_algorithm_default_value_type)\n #error \"Feature test macro for default template type for algorithms' values is missing\"\n-#elif __cpp_lib_algorithm_default_value_type < 202403L\n+#elif __cpp_lib_algorithm_default_value_type < 202603L\n #error \"Feature test macro for default template type for algorithms' values is wrong\"\n #endif\n \n #include <execution>\n+#include <memory>\n #include <ranges>\n+#include <span>\n #include <iterator>\n #include <vector>\n \n@@ -139,4 +141,15 @@ test()\n   // [alg.find.last]\n   (void) std::ranges::find_last(in.begin(), in.end(), INPUT_VAL);\n   (void) std::ranges::find_last(in, INPUT_VAL);\n+\n+  extern std::span<Input> unin;\n+  // [uninitialized.fill]\n+  (void) std::uninitialized_fill(unin.begin(), unin.end(), INPUT_VAL);\n+  (void) std::uninitialized_fill(std::execution::seq, unin.begin(), unin.end(), INPUT_VAL);\n+  (void) std::ranges::uninitialized_fill(unin.begin(), unin.end(), INPUT_VAL);\n+  (void) std::ranges::uninitialized_fill(unin, INPUT_VAL);\n+\n+  (void) std::uninitialized_fill_n(unin.begin(), unin.size(), INPUT_VAL);\n+  (void) std::uninitialized_fill_n(std::execution::seq, unin.begin(), unin.size(), INPUT_VAL);\n+  (void) std::ranges::uninitialized_fill_n(unin.begin(), unin.size(), INPUT_VAL);\n }\n","prefixes":[]}