[libcxx-commits] [libcxx] WIP [libc++][format] Partial P3391R2: `constexpr` `std::format` (PR #230239)

Lucas Mellone via libcxx-commits libcxx-commits at lists.llvm.org
Sun Oct 18 06:08:40 PDT 2026


https://github.com/lknknm updated https://github.com/llvm/llvm-project/pull/230239

>From 97060ca57e671661ac49aaed4c95bcccb734530e Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Thu, 8 Oct 2026 20:01:24 +0200
Subject: [PATCH 01/46] initial commit

---
 libcxx/docs/Status/Cxx26Papers.csv         |  2 +-
 libcxx/include/__format/format_functions.h | 32 ++++++++++++----------
 libcxx/include/format                      | 30 ++++++++++----------
 3 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/libcxx/docs/Status/Cxx26Papers.csv b/libcxx/docs/Status/Cxx26Papers.csv
index f3cdf8c53bab42..ef9e5d5c38f823 100644
--- a/libcxx/docs/Status/Cxx26Papers.csv
+++ b/libcxx/docs/Status/Cxx26Papers.csv
@@ -175,7 +175,7 @@
 "`P3887R1 <https://wg21.link/P3887R1>`__","Make ``when_all`` a Ronseal Algorithm","2025-11 (Kona)","","","`#171289 <https://github.com/llvm/llvm-project/issues/171289>`__",""
 "`P3923R0 <https://wg21.link/P3923R0>`__","Additional NB comment resolutions for Kona 2025","2025-11 (Kona)","","","`#171290 <https://github.com/llvm/llvm-project/issues/171290>`__",""
 "`P3371R5 <https://wg21.link/P3371R5>`__","Fix C++26 by making the rank-1, rank-2, rank-k, and rank-2k updates consistent with the BLAS","2025-11 (Kona)","","","`#171291 <https://github.com/llvm/llvm-project/issues/171291>`__",""
-"`P3391R2 <https://wg21.link/P3391R2>`__","``constexpr`` ``std::format``","2025-11 (Kona)","","","`#171292 <https://github.com/llvm/llvm-project/issues/171292>`__",""
+"`P3391R2 <https://wg21.link/P3391R2>`__","``constexpr`` ``std::format``","2025-11 (Kona)","|Complete|","24","`#171292 <https://github.com/llvm/llvm-project/issues/171292>`__",""
 "`P3913R1 <https://wg21.link/P3913R1>`__","Optimize ``for std::optional`` in range adaptors","2025-11 (Kona)","","","`#171294 <https://github.com/llvm/llvm-project/issues/171294>`__",""
 "","","","","","",""
 "`P3726R2 <https://wg21.link/P3726R2>`__","Adjustments to Union Lifetime Rules","2026-03 (Croydon)","","","`#189560 <https://github.com/llvm/llvm-project/issues/189560>`__",""
diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index 8f214a493a49ec..2cdcf79b05bf22 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -351,15 +351,15 @@ struct __dynamic_format_string {
   friend struct basic_format_string;
 
 public:
-  _LIBCPP_HIDE_FROM_ABI __dynamic_format_string(basic_string_view<_CharT> __s) noexcept : __str_(__s) {}
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __dynamic_format_string(basic_string_view<_CharT> __s) noexcept : __str_(__s) {}
 
   __dynamic_format_string(const __dynamic_format_string&)            = delete;
   __dynamic_format_string& operator=(const __dynamic_format_string&) = delete;
 };
 
-_LIBCPP_HIDE_FROM_ABI inline __dynamic_format_string<char> dynamic_format(string_view __fmt) noexcept { return __fmt; }
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 inline __dynamic_format_string<char> dynamic_format(string_view __fmt) noexcept { return __fmt; }
 #    if _LIBCPP_HAS_WIDE_CHARACTERS
-_LIBCPP_HIDE_FROM_ABI inline __dynamic_format_string<wchar_t> dynamic_format(wstring_view __fmt) noexcept {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 inline __dynamic_format_string<wchar_t> dynamic_format(wstring_view __fmt) noexcept {
   return __fmt;
 }
 #    endif
@@ -425,27 +425,28 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __vformat_to(_OutIt __out_it,
 // https://reviews.llvm.org/D110499#inline-1180704
 // TODO FMT Evaluate whether we want to file a Clang bug report regarding this.
 template <output_iterator<const char&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt 
+vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) {
   return std::__vformat_to(std::move(__out_it), __fmt, __args);
 }
 
 #  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
 vformat_to(_OutIt __out_it, wstring_view __fmt, wformat_args __args) {
   return std::__vformat_to(std::move(__out_it), __fmt, __args);
 }
 #  endif
 
 template <output_iterator<const char&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
 format_to(_OutIt __out_it, format_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat_to(std::move(__out_it), __fmt.get(), std::make_format_args(__args...));
 }
 
 #  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
 format_to(_OutIt __out_it, wformat_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat_to(std::move(__out_it), __fmt.get(), std::make_wformat_args(__args...));
 }
@@ -492,7 +493,8 @@ template <class _CharT>
 // TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup
 // fires too eagerly, see http://llvm.org/PR61563.
 template <class = void>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string vformat(string_view __fmt, format_args __args) {
+[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string 
+vformat(string_view __fmt, format_args __args) {
   auto __result = __format::__try_constant_folding(__fmt, __args);
   if (__result.has_value())
     return *std::move(__result);
@@ -505,7 +507,7 @@ template <class = void>
 // TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup
 // fires too eagerly, see http://llvm.org/PR61563.
 template <class = void>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring
+[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring
 vformat(wstring_view __fmt, wformat_args __args) {
   auto __result = __format::__try_constant_folding(__fmt, __args);
   if (__result.has_value())
@@ -517,14 +519,14 @@ vformat(wstring_view __fmt, wformat_args __args) {
 #  endif
 
 template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string
+[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string
 format(format_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat(__fmt.get(), std::make_format_args(__args...));
 }
 
 #  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring
+[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring
 format(wformat_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat(__fmt.get(), std::make_wformat_args(__args...));
 }
@@ -543,14 +545,14 @@ __vformat_to_n(_OutIt __out_it,
 }
 
 template <output_iterator<const char&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
 format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, format_string<_Args...> __fmt, _Args&&... __args) {
   return std::__vformat_to_n<format_context>(std::move(__out_it), __n, __fmt.get(), std::make_format_args(__args...));
 }
 
 #  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt, class... _Args>
-_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
 format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wformat_string<_Args...> __fmt, _Args&&... __args) {
   return std::__vformat_to_n<wformat_context>(std::move(__out_it), __n, __fmt.get(), std::make_wformat_args(__args...));
 }
@@ -565,14 +567,14 @@ _LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(basic_string_view<_CharT> __fmt,
 }
 
 template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t
+[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t
 formatted_size(format_string<_Args...> __fmt, _Args&&... __args) {
   return std::__vformatted_size(__fmt.get(), basic_format_args{std::make_format_args(__args...)});
 }
 
 #  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t
+[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t
 formatted_size(wformat_string<_Args...> __fmt, _Args&&... __args) {
   return std::__vformatted_size(__fmt.get(), basic_format_args{std::make_wformat_args(__args...)});
 }
diff --git a/libcxx/include/format b/libcxx/include/format
index d89c8d8b0ae89f..5f83ef33e56426 100644
--- a/libcxx/include/format
+++ b/libcxx/include/format
@@ -47,7 +47,7 @@ namespace std {
     basic_string_view<charT> str;                               // exposition-only
 
   public:
-    dynamic-format-string(basic_string_view<charT> s) noexcept : str(s) {}
+    dynamic-format-string(basic_string_view<charT> s) noexcept : str(s) {} // constexpr since C++26
 
     dynamic-format-string(const dynamic-format-string&) = delete;
     dynamic-format-string& operator=(const dynamic-format-string&) = delete;
@@ -62,32 +62,32 @@ namespace std {
 
   // [format.functions], formatting functions
   template<class... Args>
-    string format(format-string<Args...> fmt, Args&&... args);
+    string format(format-string<Args...> fmt, Args&&... args);   // constexpr since C++26
   template<class... Args>
-    wstring format(wformat-string<Args...> fmt, Args&&... args);
+    wstring format(wformat-string<Args...> fmt, Args&&... args); // constexpr since C++26
   template<class... Args>
     string format(const locale& loc, format-string<Args...> fmt, Args&&... args);
   template<class... Args>
     wstring format(const locale& loc, wformat-string<Args...> fmt, Args&&... args);
 
-  string vformat(string_view fmt, format_args args);
-  wstring vformat(wstring_view fmt, wformat_args args);
+  string vformat(string_view fmt, format_args args);    // constexpr since C++26
+  wstring vformat(wstring_view fmt, wformat_args args); // constexpr since C++26
   string vformat(const locale& loc, string_view fmt, format_args args);
   wstring vformat(const locale& loc, wstring_view fmt, wformat_args args);
 
   template<class Out, class... Args>
-    Out format_to(Out out, format-string<Args...> fmt, Args&&... args);
+    Out format_to(Out out, format-string<Args...> fmt, Args&&... args);  // constexpr since C++26
   template<class Out, class... Args>
-    Out format_to(Out out, wformat-string<Args...> fmt, Args&&... args);
+    Out format_to(Out out, wformat-string<Args...> fmt, Args&&... args); // constexpr since C++26
   template<class Out, class... Args>
     Out format_to(Out out, const locale& loc, format-string<Args...> fmt, Args&&... args);
   template<class Out, class... Args>
     Out format_to(Out out, const locale& loc, wformat-string<Args...> fmt, Args&&... args);
 
   template<class Out>
-    Out vformat_to(Out out, string_view fmt, format_args args);
+    Out vformat_to(Out out, string_view fmt, format_args args);   // constexpr since C++26
   template<class Out>
-    Out vformat_to(Out out, wstring_view fmt, wformat_args args);
+    Out vformat_to(Out out, wstring_view fmt, wformat_args args); // constexpr since C++26
   template<class Out>
     Out vformat_to(Out out, const locale& loc, string_view fmt,
                    format_args char> args);
@@ -101,10 +101,10 @@ namespace std {
   };
   template<class Out, class... Args>
     format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
-                                        format-string<Args...> fmt, Args&&... args);
+                                        format-string<Args...> fmt, Args&&... args);  // constexpr since C++26
   template<class Out, class... Args>
     format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
-                                        wformat-string<Args...> fmt, Args&&... args);
+                                        wformat-string<Args...> fmt, Args&&... args); // constexpr since C++26
   template<class Out, class... Args>
     format_to_n_result<Out> format_to_n(Out out, iter_difference_t<Out> n,
                                         const locale& loc, format-string<Args...> fmt,
@@ -115,9 +115,9 @@ namespace std {
                                         Args&&... args);
 
   template<class... Args>
-    size_t formatted_size(format-string<Args...> fmt, Args&&... args);
+    size_t formatted_size(format-string<Args...> fmt, Args&&... args);  // constexpr since C++26
   template<class... Args>
-    size_t formatted_size(wformat-string<Args...> fmt, Args&&... args);
+    size_t formatted_size(wformat-string<Args...> fmt, Args&&... args); // constexpr since C++26
   template<class... Args>
     size_t formatted_size(const locale& loc, format-string<Args...> fmt, Args&&... args);
   template<class... Args>
@@ -179,10 +179,10 @@ namespace std {
   template<class Context, class... Args> struct format-arg-store;    // exposition only
 
   template<class Context = format_context, class... Args>
-    format-arg-store<Context, Args...>
+    constexpr format-arg-store<Context, Args...>
       make_format_args(Args&... args);
   template<class... Args>
-    format-arg-store<wformat_context, Args...>
+    constexpr format-arg-store<wformat_context, Args...>
       make_wformat_args(Args&... args);
 
   // [format.error], class format_error

>From b73562f360f90d67a160dc3b879c4e57598cfe24 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Thu, 8 Oct 2026 20:25:22 +0200
Subject: [PATCH 02/46] add: constexpr to make_(w)format_args

---
 libcxx/include/__format/format_functions.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index 2cdcf79b05bf22..5bf0c86782fb59 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -69,13 +69,13 @@ using wformat_args = basic_format_args<wformat_context>;
 #  endif
 
 template <class _Context = format_context, class... _Args>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI __format_arg_store<_Context, _Args...> make_format_args(_Args&... __args) {
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __format_arg_store<_Context, _Args...> make_format_args(_Args&... __args) {
   return std::__format_arg_store<_Context, _Args...>(__args...);
 }
 
 #  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI __format_arg_store<wformat_context, _Args...> make_wformat_args(_Args&... __args) {
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __format_arg_store<wformat_context, _Args...> make_wformat_args(_Args&... __args) {
   return std::__format_arg_store<wformat_context, _Args...>(__args...);
 }
 #  endif

>From da9c1424f45c5225791f29e9015a69f81e3f7174 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Thu, 8 Oct 2026 20:30:51 +0200
Subject: [PATCH 03/46] add: constexpr to basic_format_string

---
 libcxx/include/__format/format_functions.h | 2 +-
 libcxx/include/format                      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index 5bf0c86782fb59..7cc3831ec98aad 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -376,7 +376,7 @@ struct basic_format_string {
 
   _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT> get() const noexcept { return __str_; }
 #  if _LIBCPP_STD_VER >= 26
-  _LIBCPP_HIDE_FROM_ABI basic_format_string(__dynamic_format_string<_CharT> __s) noexcept : __str_(__s.__str_) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr basic_format_string(__dynamic_format_string<_CharT> __s) noexcept : __str_(__s.__str_) {}
 #  endif
 
 private:
diff --git a/libcxx/include/format b/libcxx/include/format
index 5f83ef33e56426..7de6a8cf5fd61b 100644
--- a/libcxx/include/format
+++ b/libcxx/include/format
@@ -31,7 +31,7 @@ namespace std {
 
     public:
       template<class T> consteval basic_format_string(const T& s);
-      basic_format_string(dynamic-format-string<charT> s) noexcept : str(s.str) {}   // since C++26
+      constexpr basic_format_string(dynamic-format-string<charT> s) noexcept : str(s.str) {}   // constexpr since C++26
 
       constexpr basic_string_view<charT> get() const noexcept { return str; }
     };

>From e622b26068538a5ab51fcd1d7de36c3419e70c38 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Thu, 8 Oct 2026 20:40:33 +0200
Subject: [PATCH 04/46] fix: clang-format

---
 libcxx/include/__format/format_functions.h | 48 +++++++++++++---------
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index 7cc3831ec98aad..42301a1d9436f0 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -69,13 +69,15 @@ using wformat_args = basic_format_args<wformat_context>;
 #  endif
 
 template <class _Context = format_context, class... _Args>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __format_arg_store<_Context, _Args...> make_format_args(_Args&... __args) {
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __format_arg_store<_Context, _Args...>
+make_format_args(_Args&... __args) {
   return std::__format_arg_store<_Context, _Args...>(__args...);
 }
 
 #  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __format_arg_store<wformat_context, _Args...> make_wformat_args(_Args&... __args) {
+[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __format_arg_store<wformat_context, _Args...>
+make_wformat_args(_Args&... __args) {
   return std::__format_arg_store<wformat_context, _Args...>(__args...);
 }
 #  endif
@@ -351,15 +353,20 @@ struct __dynamic_format_string {
   friend struct basic_format_string;
 
 public:
-  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __dynamic_format_string(basic_string_view<_CharT> __s) noexcept : __str_(__s) {}
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __dynamic_format_string(basic_string_view<_CharT> __s) noexcept
+      : __str_(__s) {}
 
   __dynamic_format_string(const __dynamic_format_string&)            = delete;
   __dynamic_format_string& operator=(const __dynamic_format_string&) = delete;
 };
 
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 inline __dynamic_format_string<char> dynamic_format(string_view __fmt) noexcept { return __fmt; }
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 inline __dynamic_format_string<char>
+dynamic_format(string_view __fmt) noexcept {
+  return __fmt;
+}
 #    if _LIBCPP_HAS_WIDE_CHARACTERS
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 inline __dynamic_format_string<wchar_t> dynamic_format(wstring_view __fmt) noexcept {
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 inline __dynamic_format_string<wchar_t>
+dynamic_format(wstring_view __fmt) noexcept {
   return __fmt;
 }
 #    endif
@@ -376,7 +383,8 @@ struct basic_format_string {
 
   _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT> get() const noexcept { return __str_; }
 #  if _LIBCPP_STD_VER >= 26
-  _LIBCPP_HIDE_FROM_ABI constexpr basic_format_string(__dynamic_format_string<_CharT> __s) noexcept : __str_(__s.__str_) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr basic_format_string(__dynamic_format_string<_CharT> __s) noexcept
+      : __str_(__s.__str_) {}
 #  endif
 
 private:
@@ -425,29 +433,29 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __vformat_to(_OutIt __out_it,
 // https://reviews.llvm.org/D110499#inline-1180704
 // TODO FMT Evaluate whether we want to file a Clang bug report regarding this.
 template <output_iterator<const char&> _OutIt>
-_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt 
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
 vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) {
   return std::__vformat_to(std::move(__out_it), __fmt, __args);
 }
 
 #  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt>
-_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-vformat_to(_OutIt __out_it, wstring_view __fmt, wformat_args __args) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE
+_LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(_OutIt __out_it, wstring_view __fmt, wformat_args __args) {
   return std::__vformat_to(std::move(__out_it), __fmt, __args);
 }
 #  endif
 
 template <output_iterator<const char&> _OutIt, class... _Args>
-_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-format_to(_OutIt __out_it, format_string<_Args...> __fmt, _Args&&... __args) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE
+_LIBCPP_HIDE_FROM_ABI _OutIt format_to(_OutIt __out_it, format_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat_to(std::move(__out_it), __fmt.get(), std::make_format_args(__args...));
 }
 
 #  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt, class... _Args>
-_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-format_to(_OutIt __out_it, wformat_string<_Args...> __fmt, _Args&&... __args) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE
+_LIBCPP_HIDE_FROM_ABI _OutIt format_to(_OutIt __out_it, wformat_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat_to(std::move(__out_it), __fmt.get(), std::make_wformat_args(__args...));
 }
 #  endif
@@ -493,7 +501,7 @@ template <class _CharT>
 // TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup
 // fires too eagerly, see http://llvm.org/PR61563.
 template <class = void>
-[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string 
+[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string
 vformat(string_view __fmt, format_args __args) {
   auto __result = __format::__try_constant_folding(__fmt, __args);
   if (__result.has_value())
@@ -519,15 +527,15 @@ vformat(wstring_view __fmt, wformat_args __args) {
 #  endif
 
 template <class... _Args>
-[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string
-format(format_string<_Args...> __fmt, _Args&&... __args) {
+[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE
+_LIBCPP_HIDE_FROM_ABI string format(format_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat(__fmt.get(), std::make_format_args(__args...));
 }
 
 #  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
-[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring
-format(wformat_string<_Args...> __fmt, _Args&&... __args) {
+[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE
+_LIBCPP_HIDE_FROM_ABI wstring format(wformat_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat(__fmt.get(), std::make_wformat_args(__args...));
 }
 #  endif
@@ -574,8 +582,8 @@ formatted_size(format_string<_Args...> __fmt, _Args&&... __args) {
 
 #  if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
-[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t
-formatted_size(wformat_string<_Args...> __fmt, _Args&&... __args) {
+[[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE
+_LIBCPP_HIDE_FROM_ABI size_t formatted_size(wformat_string<_Args...> __fmt, _Args&&... __args) {
   return std::__vformatted_size(__fmt.get(), basic_format_args{std::make_wformat_args(__args...)});
 }
 #  endif

>From 98d695fe360e229462567f2b9e5a372187911aec Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Thu, 8 Oct 2026 21:51:00 +0200
Subject: [PATCH 05/46] add: constexpr to vformat

---
 libcxx/include/__format/format_functions.h | 45 ++++++++++++----------
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index 42301a1d9436f0..c883ec206df853 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -415,9 +415,10 @@ using wformat_string = basic_format_string<wchar_t, type_identity_t<_Args>...>;
 
 template <class _OutIt, class _CharT, class _FormatOutIt>
   requires(output_iterator<_OutIt, const _CharT&>)
-_LIBCPP_HIDE_FROM_ABI _OutIt __vformat_to(_OutIt __out_it,
-                                          basic_string_view<_CharT> __fmt,
-                                          basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) {
+_LIBCPP_HIDE_FROM_ABI constexpr _OutIt
+__vformat_to(_OutIt __out_it,
+             basic_string_view<_CharT> __fmt,
+             basic_format_args<basic_format_context<_FormatOutIt, _CharT>> __args) {
   if constexpr (same_as<_OutIt, _FormatOutIt>)
     return std::__format::__vformat_to(
         basic_format_parse_context{__fmt, __args.__size()}, std::__format_context_create(std::move(__out_it), __args));
@@ -503,9 +504,13 @@ template <class _CharT>
 template <class = void>
 [[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string
 vformat(string_view __fmt, format_args __args) {
-  auto __result = __format::__try_constant_folding(__fmt, __args);
-  if (__result.has_value())
-    return *std::move(__result);
+  // P3391R2: We don't need constant folding runtime optimizations in the scope of a constant evaluation.
+  // `if !consteval` is only present since C++23. 
+  if (!__libcpp_is_constant_evaluated()) {
+    auto __result = __format::__try_constant_folding(__fmt, __args);
+    if (__result.has_value())
+      return *std::move(__result);
+  }
   __format::__allocating_buffer<char> __buffer;
   std::vformat_to(__buffer.__make_output_iterator(), __fmt, __args);
   return string{__buffer.__view()};
@@ -541,7 +546,7 @@ _LIBCPP_HIDE_FROM_ABI wstring format(wformat_string<_Args...> __fmt, _Args&&...
 #  endif
 
 template <class _Context, class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt>
+_LIBCPP_HIDE_FROM_ABI constexpr format_to_n_result<_OutIt>
 __vformat_to_n(_OutIt __out_it,
                iter_difference_t<_OutIt> __n,
                basic_string_view<_CharT> __fmt,
@@ -567,7 +572,7 @@ format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wformat_string<_Args
 #  endif
 
 template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI size_t __vformatted_size(basic_string_view<_CharT> __fmt, auto __args) {
+_LIBCPP_HIDE_FROM_ABI constexpr size_t __vformatted_size(basic_string_view<_CharT> __fmt, auto __args) {
   __format::__formatted_size_buffer<_CharT> __buffer;
   std::__format::__vformat_to(basic_format_parse_context{__fmt, __args.__size()},
                               std::__format_context_create(__buffer.__make_output_iterator(), __args));
@@ -617,22 +622,22 @@ vformat_to(_OutIt __out_it, locale __loc, string_view __fmt, format_args __args)
 
 #    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-vformat_to(_OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) {
+_LIBCPP_ALWAYS_INLINE
+_LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(_OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) {
   return std::__vformat_to(std::move(__out_it), std::move(__loc), __fmt, __args);
 }
 #    endif
 
 template <output_iterator<const char&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-format_to(_OutIt __out_it, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI
+_OutIt format_to(_OutIt __out_it, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(), std::make_format_args(__args...));
 }
 
 #    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
-format_to(_OutIt __out_it, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI
+_OutIt format_to(_OutIt __out_it, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(), std::make_wformat_args(__args...));
 }
 #    endif
@@ -660,15 +665,15 @@ vformat(locale __loc, wstring_view __fmt, wformat_args __args) {
 #    endif
 
 template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string
-format(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
+[[nodiscard]] _LIBCPP_ALWAYS_INLINE
+_LIBCPP_HIDE_FROM_ABI string format(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat(std::move(__loc), __fmt.get(), std::make_format_args(__args...));
 }
 
 #    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring
-format(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
+[[nodiscard]] _LIBCPP_ALWAYS_INLINE
+_LIBCPP_HIDE_FROM_ABI wstring format(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat(std::move(__loc), __fmt.get(), std::make_wformat_args(__args...));
 }
 #    endif
@@ -720,8 +725,8 @@ formatted_size(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
 
 #    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t
-formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
+[[nodiscard]] _LIBCPP_ALWAYS_INLINE
+_LIBCPP_HIDE_FROM_ABI size_t formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
   return std::__vformatted_size(std::move(__loc), __fmt.get(), basic_format_args{std::make_wformat_args(__args...)});
 }
 #    endif

>From 9681d225748e47e412d10102949f8c4010b83696 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Thu, 8 Oct 2026 21:52:07 +0200
Subject: [PATCH 06/46] update comment

---
 libcxx/include/__format/format_functions.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index c883ec206df853..da7a46c458440e 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -505,7 +505,7 @@ template <class = void>
 [[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string
 vformat(string_view __fmt, format_args __args) {
   // P3391R2: We don't need constant folding runtime optimizations in the scope of a constant evaluation.
-  // `if !consteval` is only present since C++23. 
+  // `if !consteval` is only present since C++23, so we use !__libcpp_is_constant_evaluated(). 
   if (!__libcpp_is_constant_evaluated()) {
     auto __result = __format::__try_constant_folding(__fmt, __args);
     if (__result.has_value())

>From f9b79f9b8c74b92c4cec38c7017117b7a9858341 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Thu, 8 Oct 2026 21:54:50 +0200
Subject: [PATCH 07/46] clang-format: remove trailing space

---
 libcxx/include/__format/format_functions.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index da7a46c458440e..132d7121c2cd03 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -505,7 +505,7 @@ template <class = void>
 [[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string
 vformat(string_view __fmt, format_args __args) {
   // P3391R2: We don't need constant folding runtime optimizations in the scope of a constant evaluation.
-  // `if !consteval` is only present since C++23, so we use !__libcpp_is_constant_evaluated(). 
+  // `if !consteval` is only present since C++23, so we use !__libcpp_is_constant_evaluated().
   if (!__libcpp_is_constant_evaluated()) {
     auto __result = __format::__try_constant_folding(__fmt, __args);
     if (__result.has_value())

>From cc86a22ad0e1968c7e8d0cddb3ca05471623d773 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Fri, 9 Oct 2026 10:05:45 +0200
Subject: [PATCH 08/46] add __libcpp_is_constant_evaluated() for wstring
 vformat()

---
 libcxx/include/__format/format_functions.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index 132d7121c2cd03..1f7febdfddbb0e 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -522,9 +522,13 @@ vformat(string_view __fmt, format_args __args) {
 template <class = void>
 [[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring
 vformat(wstring_view __fmt, wformat_args __args) {
-  auto __result = __format::__try_constant_folding(__fmt, __args);
-  if (__result.has_value())
-    return *std::move(__result);
+  // P3391R2: We don't need constant folding runtime optimizations in the scope of a constant evaluation.
+  // `if !consteval` is only present since C++23, so we use !__libcpp_is_constant_evaluated().
+  if (!__libcpp_is_constant_evaluated()) {
+    auto __result = __format::__try_constant_folding(__fmt, __args);
+    if (__result.has_value())
+      return *std::move(__result);
+  }
   __format::__allocating_buffer<wchar_t> __buffer;
   std::vformat_to(__buffer.__make_output_iterator(), __fmt, __args);
   return wstring{__buffer.__view()};

>From 4e969da8cbb82157ac58b6f63f323c0594acdced Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Fri, 9 Oct 2026 12:53:40 +0200
Subject: [PATCH 09/46] add: constexpr to basic_format_args. tests failing is
 expected

---
 libcxx/include/__format/format_args.h         |  8 ++-
 .../format.constexpr.pass.cpp                 | 59 +++++++++++++++++++
 2 files changed, 64 insertions(+), 3 deletions(-)
 create mode 100644 libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp

diff --git a/libcxx/include/__format/format_args.h b/libcxx/include/__format/format_args.h
index f1b648a10ac4f8..894b593bd3cb9f 100644
--- a/libcxx/include/__format/format_args.h
+++ b/libcxx/include/__format/format_args.h
@@ -29,7 +29,8 @@ template <class _Context>
 class basic_format_args {
 public:
   template <class... _Args>
-  _LIBCPP_HIDE_FROM_ABI basic_format_args(const __format_arg_store<_Context, _Args...>& __store) noexcept
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+  basic_format_args(const __format_arg_store<_Context, _Args...>& __store) noexcept
       : __size_(sizeof...(_Args)) {
     if constexpr (sizeof...(_Args) != 0) {
       if constexpr (__format::__use_packed_format_arg_store(sizeof...(_Args))) {
@@ -40,7 +41,8 @@ class basic_format_args {
     }
   }
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> get(size_t __id) const noexcept {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 basic_format_arg<_Context>
+  get(size_t __id) const noexcept {
     if (__id >= __size_)
       return basic_format_arg<_Context>{};
 
@@ -50,7 +52,7 @@ class basic_format_args {
     return __args_[__id];
   }
 
-  _LIBCPP_HIDE_FROM_ABI size_t __size() const noexcept { return __size_; }
+  _LIBCPP_HIDE_FROM_ABI constexpr size_t __size() const noexcept { return __size_; }
 
 private:
   size_t __size_{0};
diff --git a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
new file mode 100644
index 00000000000000..78c70754edd8b3
--- /dev/null
+++ b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
@@ -0,0 +1,59 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
+
+// <format>
+
+// template<class... Args>
+//   constexpr string format(format-string<Args...> fmt, Args&&... args);
+// template<class... Args>
+//   constexpr wstring format(wformat-string<Args...> fmt, Args&&... args);
+
+#include <cassert>
+#include <format>
+#include <string>
+#include <string_view>
+
+#include "test_macros.h"
+
+constexpr bool test() {
+  // No replacement fields
+  assert(std::format("hello") == "hello");
+
+  // Integers
+  assert(std::format("{}", 42) == "42");
+  assert(std::format("{}", -42) == "-42");
+  assert(std::format("{:x}", 255u) == "ff");
+  assert(std::format("{:>5}", 42) == "   42");
+
+  // bool and char
+  assert(std::format("{}", true) == "true");
+  assert(std::format("{}", 'a') == "a");
+
+  // Strings
+  assert(std::format("{}", "abc") == "abc");
+  assert(std::format("{}", std::string_view{"abc"}) == "abc");
+  assert(std::format("{:*^7}", "abc") == "**abc**");
+
+  // Several arguments
+  assert(std::format("{} + {} = {}", 1, 2, 3) == "1 + 2 = 3");
+
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+  assert(std::format(L"{}", 42) == L"42");
+#endif
+
+  return true;
+}
+
+int main(int, char**) {
+  test();
+  static_assert(test());
+
+  return 0;
+}

>From ea2d45e991a8f0e246fb229c068a89ac81c1fac7 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Fri, 9 Oct 2026 14:55:47 +0200
Subject: [PATCH 10/46] fix: crawling back from failing tests and verifying
 constexpr in format_context.h

---
 libcxx/include/__format/buffer.h              | 28 ++++++++++---------
 libcxx/include/__format/format_arg_store.h    |  2 +-
 libcxx/include/__format/format_context.h      | 10 ++++---
 .../format.constexpr.pass.cpp                 | 22 +++++++--------
 4 files changed, 33 insertions(+), 29 deletions(-)

diff --git a/libcxx/include/__format/buffer.h b/libcxx/include/__format/buffer.h
index f53f4d60b7d4c4..8ee5053773c0de 100644
--- a/libcxx/include/__format/buffer.h
+++ b/libcxx/include/__format/buffer.h
@@ -185,10 +185,11 @@ class __output_buffer {
   using __prepare_write_type _LIBCPP_NODEBUG = void (*)(__output_buffer<_CharT>&, size_t);
 
   [[nodiscard]]
-  _LIBCPP_HIDE_FROM_ABI explicit __output_buffer(_CharT* __ptr, size_t __capacity, __prepare_write_type __function)
+  _LIBCPP_HIDE_FROM_ABI explicit constexpr __output_buffer(
+      _CharT* __ptr, size_t __capacity, __prepare_write_type __function)
       : __output_buffer{__ptr, __capacity, __function, nullptr} {}
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit __output_buffer(
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr explicit __output_buffer(
       _CharT* __ptr, size_t __capacity, __prepare_write_type __function, __max_output_size* __max_output_size)
       : __ptr_(__ptr), __capacity_(__capacity), __prepare_write_(__function), __max_output_size_(__max_output_size) {}
 
@@ -199,10 +200,10 @@ class __output_buffer {
     __capacity_ = __capacity;
   }
 
-  _LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return std::back_insert_iterator{*this}; }
+  _LIBCPP_HIDE_FROM_ABI constexpr auto __make_output_iterator() { return std::back_insert_iterator{*this}; }
 
   // Used in std::back_insert_iterator.
-  _LIBCPP_HIDE_FROM_ABI void push_back(_CharT __c) {
+  _LIBCPP_HIDE_FROM_ABI constexpr void push_back(_CharT __c) {
     if (__max_output_size_ && __max_output_size_->__write_request(1) == 0)
       return;
 
@@ -222,7 +223,7 @@ class __output_buffer {
   /// Since some of the input is generated by std::to_chars, there needs to be a
   /// conversion when _CharT is wchar_t.
   template <__fmt_char_type _InCharT>
-  _LIBCPP_HIDE_FROM_ABI void __copy(basic_string_view<_InCharT> __str) {
+  _LIBCPP_HIDE_FROM_ABI constexpr void __copy(basic_string_view<_InCharT> __str) {
     // When the underlying iterator is a simple iterator the __capacity_ is
     // infinite. For a string or container back_inserter it isn't. This means
     // that adding a large string to the buffer can cause some overhead. In that
@@ -262,7 +263,7 @@ class __output_buffer {
   template <contiguous_iterator _Iterator,
             class _UnaryOperation,
             __fmt_char_type _InCharT = typename iterator_traits<_Iterator>::value_type>
-  _LIBCPP_HIDE_FROM_ABI void __transform(_Iterator __first, _Iterator __last, _UnaryOperation __operation) {
+  _LIBCPP_HIDE_FROM_ABI constexpr void __transform(_Iterator __first, _Iterator __last, _UnaryOperation __operation) {
     _LIBCPP_ASSERT_INTERNAL(__first <= __last, "not a valid range");
 
     size_t __n = static_cast<size_t>(__last - __first);
@@ -287,7 +288,7 @@ class __output_buffer {
   }
 
   /// A \c fill_n wrapper.
-  _LIBCPP_HIDE_FROM_ABI void __fill(size_t __n, _CharT __value) {
+  _LIBCPP_HIDE_FROM_ABI constexpr void __fill(size_t __n, _CharT __value) {
     if (__max_output_size_) {
       __n = __max_output_size_->__write_request(__n);
       if (__n == 0)
@@ -367,10 +368,10 @@ class __allocating_buffer : public __output_buffer<_CharT> {
   __allocating_buffer(const __allocating_buffer&)            = delete;
   __allocating_buffer& operator=(const __allocating_buffer&) = delete;
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI __allocating_buffer() : __allocating_buffer{nullptr} {}
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __allocating_buffer() : __allocating_buffer{nullptr} {}
 
   [[nodiscard]]
-  _LIBCPP_HIDE_FROM_ABI explicit __allocating_buffer(__max_output_size* __max_output_size)
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit __allocating_buffer(__max_output_size* __max_output_size)
       : __output_buffer<_CharT>{__small_buffer_, __buffer_size_, __prepare_write, __max_output_size} {}
 
   _LIBCPP_HIDE_FROM_ABI ~__allocating_buffer() {
@@ -421,11 +422,12 @@ class __allocating_buffer : public __output_buffer<_CharT> {
 template <class _OutIt, __fmt_char_type _CharT>
 class __direct_iterator_buffer : public __output_buffer<_CharT> {
 public:
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit __direct_iterator_buffer(_OutIt __out_it)
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit constexpr __direct_iterator_buffer(_OutIt __out_it)
       : __direct_iterator_buffer{__out_it, nullptr} {}
 
   [[nodiscard]]
-  _LIBCPP_HIDE_FROM_ABI explicit __direct_iterator_buffer(_OutIt __out_it, __max_output_size* __max_output_size)
+  _LIBCPP_HIDE_FROM_ABI explicit constexpr 
+  __direct_iterator_buffer(_OutIt __out_it, __max_output_size* __max_output_size)
       : __output_buffer<_CharT>{std::__unwrap_iter(__out_it), __buffer_size, __prepare_write, __max_output_size},
         __out_it_(__out_it) {}
 
@@ -450,11 +452,11 @@ class __direct_iterator_buffer : public __output_buffer<_CharT> {
 template <class _OutIt, __fmt_char_type _CharT>
 class __container_inserter_buffer : public __output_buffer<_CharT> {
 public:
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit __container_inserter_buffer(_OutIt __out_it)
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit constexpr __container_inserter_buffer(_OutIt __out_it)
       : __container_inserter_buffer{__out_it, nullptr} {}
 
   [[nodiscard]]
-  _LIBCPP_HIDE_FROM_ABI explicit __container_inserter_buffer(_OutIt __out_it, __max_output_size* __max_output_size)
+  _LIBCPP_HIDE_FROM_ABI explicit constexpr __container_inserter_buffer(_OutIt __out_it, __max_output_size* __max_output_size)
       : __output_buffer<_CharT>{__small_buffer_, __buffer_size, __prepare_write, __max_output_size},
         __container_{__out_it.__get_container()} {}
 
diff --git a/libcxx/include/__format/format_arg_store.h b/libcxx/include/__format/format_arg_store.h
index 3f88161a5edd96..96398eab9c072b 100644
--- a/libcxx/include/__format/format_arg_store.h
+++ b/libcxx/include/__format/format_arg_store.h
@@ -258,7 +258,7 @@ struct __unpacked_format_arg_store {
 
 template <class _Context, class... _Args>
 struct __format_arg_store {
-  _LIBCPP_HIDE_FROM_ABI __format_arg_store(_Args&... __args) noexcept {
+  _LIBCPP_HIDE_FROM_ABI constexpr __format_arg_store(_Args&... __args) noexcept {
     if constexpr (sizeof...(_Args) != 0) {
       if constexpr (__format::__use_packed_format_arg_store(sizeof...(_Args)))
         __format::__create_packed_storage(__storage.__types_, __storage.__values_, __args...);
diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index 09a45cac28c57d..6e07c18afe12a1 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -49,7 +49,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
  * This is needed since the constructor is private.
  */
 template <class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI basic_format_context<_OutIt, _CharT>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 basic_format_context<_OutIt, _CharT>
 __format_context_create(_OutIt __out_it,
                         basic_format_args<basic_format_context<_OutIt, _CharT>> __args,
                         optional<std::locale>&& __loc = nullopt) {
@@ -57,7 +57,7 @@ __format_context_create(_OutIt __out_it,
 }
 #  else
 template <class _OutIt, class _CharT>
-_LIBCPP_HIDE_FROM_ABI basic_format_context<_OutIt, _CharT>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 basic_format_context<_OutIt, _CharT>
 __format_context_create(_OutIt __out_it, basic_format_args<basic_format_context<_OutIt, _CharT>> __args) {
   return std::basic_format_context(std::move(__out_it), __args);
 }
@@ -79,7 +79,8 @@ class _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_
 
   static_assert(output_iterator<_OutIt, const _CharT&>, "[format.context]/p3 requires OutIt to be an output_iterator");
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 basic_format_arg<basic_format_context>
+  arg(size_t __id) const noexcept {
     return __args_.get(__id);
   }
 #  if _LIBCPP_HAS_LOCALIZATION
@@ -89,7 +90,8 @@ class _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_
     return *__loc_;
   }
 #  endif
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI iterator out() { return std::move(__out_it_); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
+  out() { return std::move(__out_it_); }
   _LIBCPP_HIDE_FROM_ABI void advance_to(iterator __it) { __out_it_ = std::move(__it); }
 
 private:
diff --git a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
index 78c70754edd8b3..93879f0d56b418 100644
--- a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
@@ -27,25 +27,25 @@ constexpr bool test() {
   assert(std::format("hello") == "hello");
 
   // Integers
-  assert(std::format("{}", 42) == "42");
-  assert(std::format("{}", -42) == "-42");
-  assert(std::format("{:x}", 255u) == "ff");
-  assert(std::format("{:>5}", 42) == "   42");
+  // assert(std::format("{}", 42) == "42");
+  // assert(std::format("{}", -42) == "-42");
+  // assert(std::format("{:x}", 255u) == "ff");
+  // assert(std::format("{:>5}", 42) == "   42");
 
   // bool and char
-  assert(std::format("{}", true) == "true");
-  assert(std::format("{}", 'a') == "a");
+  // assert(std::format("{}", true) == "true");
+  // assert(std::format("{}", 'a') == "a");
 
   // Strings
-  assert(std::format("{}", "abc") == "abc");
-  assert(std::format("{}", std::string_view{"abc"}) == "abc");
-  assert(std::format("{:*^7}", "abc") == "**abc**");
+  // assert(std::format("{}", "abc") == "abc");
+  //  assert(std::format("{}", std::string_view{"abc"}) == "abc");
+  //  assert(std::format("{:*^7}", "abc") == "**abc**");
 
   // Several arguments
-  assert(std::format("{} + {} = {}", 1, 2, 3) == "1 + 2 = 3");
+  // assert(std::format("{} + {} = {}", 1, 2, 3) == "1 + 2 = 3");
 
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
-  assert(std::format(L"{}", 42) == L"42");
+  // assert(std::format(L"{}", 42) == L"42");
 #endif
 
   return true;

>From f01b2423400d1de65ae149a98b9ceb4e57aba368 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Fri, 9 Oct 2026 17:26:56 +0200
Subject: [PATCH 11/46] fix: first proposed test is working

---
 libcxx/include/__format/buffer.h         | 17 +++++++++--------
 libcxx/include/__format/format_context.h | 11 +++++++----
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/libcxx/include/__format/buffer.h b/libcxx/include/__format/buffer.h
index 8ee5053773c0de..8827193f09c66d 100644
--- a/libcxx/include/__format/buffer.h
+++ b/libcxx/include/__format/buffer.h
@@ -308,8 +308,8 @@ class __output_buffer {
       __prepare_write(0);
   }
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_t __capacity() const { return __capacity_; }
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_t __size() const { return __size_; }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t __capacity() const { return __capacity_; }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t __size() const { return __size_; }
 
 private:
   _CharT* __ptr_;
@@ -374,12 +374,12 @@ class __allocating_buffer : public __output_buffer<_CharT> {
   _LIBCPP_HIDE_FROM_ABI constexpr explicit __allocating_buffer(__max_output_size* __max_output_size)
       : __output_buffer<_CharT>{__small_buffer_, __buffer_size_, __prepare_write, __max_output_size} {}
 
-  _LIBCPP_HIDE_FROM_ABI ~__allocating_buffer() {
+  _LIBCPP_HIDE_FROM_ABI constexpr ~__allocating_buffer() {
     if (__ptr_ != __small_buffer_)
       _Alloc{}.deallocate(__ptr_, this->__capacity());
   }
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI basic_string_view<_CharT> __view() { return {__ptr_, this->__size()}; }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT> __view() { return {__ptr_, this->__size()}; }
 
 private:
   using _Alloc _LIBCPP_NODEBUG = allocator<_CharT>;
@@ -426,8 +426,8 @@ class __direct_iterator_buffer : public __output_buffer<_CharT> {
       : __direct_iterator_buffer{__out_it, nullptr} {}
 
   [[nodiscard]]
-  _LIBCPP_HIDE_FROM_ABI explicit constexpr 
-  __direct_iterator_buffer(_OutIt __out_it, __max_output_size* __max_output_size)
+  _LIBCPP_HIDE_FROM_ABI explicit constexpr __direct_iterator_buffer(
+      _OutIt __out_it, __max_output_size* __max_output_size)
       : __output_buffer<_CharT>{std::__unwrap_iter(__out_it), __buffer_size, __prepare_write, __max_output_size},
         __out_it_(__out_it) {}
 
@@ -456,7 +456,8 @@ class __container_inserter_buffer : public __output_buffer<_CharT> {
       : __container_inserter_buffer{__out_it, nullptr} {}
 
   [[nodiscard]]
-  _LIBCPP_HIDE_FROM_ABI explicit constexpr __container_inserter_buffer(_OutIt __out_it, __max_output_size* __max_output_size)
+  _LIBCPP_HIDE_FROM_ABI explicit constexpr __container_inserter_buffer(
+      _OutIt __out_it, __max_output_size* __max_output_size)
       : __output_buffer<_CharT>{__small_buffer_, __buffer_size, __prepare_write, __max_output_size},
         __container_{__out_it.__get_container()} {}
 
@@ -633,7 +634,7 @@ class __retarget_buffer {
     __capacity_   = __result.count;
   }
 
-  _LIBCPP_HIDE_FROM_ABI ~__retarget_buffer() {
+  _LIBCPP_HIDE_FROM_ABI constexpr ~__retarget_buffer() {
     std::destroy_n(__ptr_, __size_);
     allocator_traits<_Alloc>::deallocate(__alloc_, __ptr_, __capacity_);
   }
diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index 6e07c18afe12a1..eb7629f6bf5fe0 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -10,6 +10,7 @@
 #ifndef _LIBCPP___FORMAT_FORMAT_CONTEXT_H
 #define _LIBCPP___FORMAT_FORMAT_CONTEXT_H
 
+#include "__configuration/language.h"
 #include <__concepts/same_as.h>
 #include <__config>
 #include <__cstddef/size_t.h>
@@ -111,19 +112,21 @@ class _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_
   optional<std::locale> __loc_;
 
   template <class _OtherOutIt, class _OtherCharT>
-  friend _LIBCPP_HIDE_FROM_ABI basic_format_context<_OtherOutIt, _OtherCharT> __format_context_create(
+  friend _LIBCPP_HIDE_FROM_ABI constexpr basic_format_context<_OtherOutIt, _OtherCharT> 
+__format_context_create(
       _OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>, optional<std::locale>&&);
 
   // Note: the Standard doesn't specify the required constructors.
-  _LIBCPP_HIDE_FROM_ABI explicit basic_format_context(
+  _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR_SINCE_CXX26 basic_format_context(
       _OutIt __out_it, basic_format_args<basic_format_context> __args, optional<std::locale>&& __loc)
       : __out_it_(std::move(__out_it)), __args_(__args), __loc_(std::move(__loc)) {}
 #  else
   template <class _OtherOutIt, class _OtherCharT>
-  friend _LIBCPP_HIDE_FROM_ABI basic_format_context<_OtherOutIt, _OtherCharT>
+  friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26  basic_format_context<_OtherOutIt, _OtherCharT>
       __format_context_create(_OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>);
 
-  _LIBCPP_HIDE_FROM_ABI explicit basic_format_context(_OutIt __out_it, basic_format_args<basic_format_context> __args)
+  _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR_SINCE_CXX26
+  basic_format_context(_OutIt __out_it, basic_format_args<basic_format_context> __args)
       : __out_it_(std::move(__out_it)), __args_(__args) {}
 #  endif
 

>From 2b857eb69f24959e406f84cbdb0710faa55a6dec Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Fri, 9 Oct 2026 17:49:11 +0200
Subject: [PATCH 12/46] mark all __basic_format_arg_value as constexpr

---
 libcxx/include/__format/format_arg.h          | 32 +++++++++----------
 .../format.constexpr.pass.cpp                 |  2 +-
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h
index 4f52c6ab2c3e4d..24ca4843f42ea4 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -254,26 +254,26 @@ class __basic_format_arg_value {
   // These constructors contain the exact storage type used. If adjustments are
   // required, these will be done in __create_format_arg.
 
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value() noexcept : __monostate_() {}
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(bool __value) noexcept : __boolean_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(_CharT __value) noexcept : __char_type_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(int __value) noexcept : __int_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(unsigned __value) noexcept : __unsigned_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(long long __value) noexcept : __long_long_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(unsigned long long __value) noexcept
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value() noexcept : __monostate_() {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(bool __value) noexcept : __boolean_(__value) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(_CharT __value) noexcept : __char_type_(__value) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(int __value) noexcept : __int_(__value) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(unsigned __value) noexcept : __unsigned_(__value) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(long long __value) noexcept : __long_long_(__value) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(unsigned long long __value) noexcept
       : __unsigned_long_long_(__value) {}
 #  if _LIBCPP_HAS_INT128
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(__int128_t __value) noexcept : __i128_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(__uint128_t __value) noexcept : __u128_(__value) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(__int128_t __value) noexcept : __i128_(__value) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(__uint128_t __value) noexcept : __u128_(__value) {}
 #  endif
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(float __value) noexcept : __float_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(double __value) noexcept : __double_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(long double __value) noexcept : __long_double_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(const _CharT* __value) noexcept : __const_char_type_ptr_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(basic_string_view<_CharT> __value) noexcept
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(float __value) noexcept : __float_(__value) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(double __value) noexcept : __double_(__value) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(long double __value) noexcept : __long_double_(__value) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(const _CharT* __value) noexcept : __const_char_type_ptr_(__value) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(basic_string_view<_CharT> __value) noexcept
       : __string_view_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(const void* __value) noexcept : __ptr_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(__handle&& __value) noexcept : __handle_(std::move(__value)) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(const void* __value) noexcept : __ptr_(__value) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(__handle&& __value) noexcept : __handle_(std::move(__value)) {}
 };
 
 template <class _Context>
diff --git a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
index 93879f0d56b418..3f2e45892832c3 100644
--- a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
@@ -27,7 +27,7 @@ constexpr bool test() {
   assert(std::format("hello") == "hello");
 
   // Integers
-  // assert(std::format("{}", 42) == "42");
+  assert(std::format("{}", 42) == "42");
   // assert(std::format("{}", -42) == "-42");
   // assert(std::format("{:x}", 255u) == "ff");
   // assert(std::format("{:>5}", 42) == "   42");

>From 5a83ced6ed61d566872c61c312fbacd9f372f977 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Fri, 9 Oct 2026 18:04:13 +0200
Subject: [PATCH 13/46] add: clarification comment

---
 libcxx/include/__format/format_arg.h                           | 3 +++
 .../format/format.functions/format.constexpr.pass.cpp          | 1 +
 2 files changed, 4 insertions(+)

diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h
index 24ca4843f42ea4..c10eea10dd637b 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -253,6 +253,9 @@ class __basic_format_arg_value {
 
   // These constructors contain the exact storage type used. If adjustments are
   // required, these will be done in __create_format_arg.
+  // P3391R2: make_format_args and the basic_format_arg constructors constexpr for every argument type.
+  // An argument is stored even when the format string never uses it, e.g. std::format("{}", 42, 3.0).
+  // Only formatting floating-point and pointer values remains non-constant.
 
   _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value() noexcept : __monostate_() {}
   _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(bool __value) noexcept : __boolean_(__value) {}
diff --git a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
index 3f2e45892832c3..493f61864afc41 100644
--- a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
@@ -28,6 +28,7 @@ constexpr bool test() {
 
   // Integers
   assert(std::format("{}", 42) == "42");
+  assert(std::format("{}", 42, 3.0) == "42");  // 3.0 is stored but never formatted
   // assert(std::format("{}", -42) == "-42");
   // assert(std::format("{:x}", 255u) == "ff");
   // assert(std::format("{:>5}", 42) == "   42");

>From 47af0a44a6aa057fc097309519487388a8bc3501 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Fri, 9 Oct 2026 18:43:13 +0200
Subject: [PATCH 14/46] update comment

---
 libcxx/include/__format/format_arg.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h
index c10eea10dd637b..4ef74b11372914 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -253,9 +253,10 @@ class __basic_format_arg_value {
 
   // These constructors contain the exact storage type used. If adjustments are
   // required, these will be done in __create_format_arg.
+  // 
   // P3391R2: make_format_args and the basic_format_arg constructors constexpr for every argument type.
   // An argument is stored even when the format string never uses it, e.g. std::format("{}", 42, 3.0).
-  // Only formatting floating-point and pointer values remains non-constant.
+  // Only formatting floating-point and pointer values remains non-constant as per the paper's definition.
 
   _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value() noexcept : __monostate_() {}
   _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(bool __value) noexcept : __boolean_(__value) {}

>From 8bd6e1acab1fc1ca80bb442b6ca384a9c11e1b1c Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Fri, 9 Oct 2026 18:44:20 +0200
Subject: [PATCH 15/46] update comment to formal grammar

---
 libcxx/include/__format/format_arg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h
index 4ef74b11372914..bb30e3bf771fcd 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -256,7 +256,7 @@ class __basic_format_arg_value {
   // 
   // P3391R2: make_format_args and the basic_format_arg constructors constexpr for every argument type.
   // An argument is stored even when the format string never uses it, e.g. std::format("{}", 42, 3.0).
-  // Only formatting floating-point and pointer values remains non-constant as per the paper's definition.
+  // Only formatting floating-point and pointer values remains non-constant as the paper defines it.
 
   _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value() noexcept : __monostate_() {}
   _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(bool __value) noexcept : __boolean_(__value) {}

>From dbff219e727d49558cf843882c362858ac3f9f83 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Mon, 12 Oct 2026 19:56:27 +0200
Subject: [PATCH 16/46] update: add constexpr for test to be passable

---
 libcxx/include/__format/buffer.h              |  4 +--
 libcxx/include/__format/format_arg.h          |  6 ++---
 libcxx/include/__format/format_arg_store.h    |  5 ++--
 libcxx/include/__format/format_context.h      |  3 ++-
 libcxx/include/__format/formatter_integer.h   |  3 ++-
 libcxx/include/__format/formatter_integral.h  | 25 +++++++++---------
 libcxx/include/__format/formatter_output.h    | 26 +++++++++----------
 .../include/__format/parser_std_format_spec.h |  6 ++---
 8 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/libcxx/include/__format/buffer.h b/libcxx/include/__format/buffer.h
index 8827193f09c66d..a76769601183db 100644
--- a/libcxx/include/__format/buffer.h
+++ b/libcxx/include/__format/buffer.h
@@ -318,9 +318,9 @@ class __output_buffer {
   void (*__prepare_write_)(__output_buffer<_CharT>&, size_t);
   __max_output_size* __max_output_size_;
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_t __available() const { return __capacity_ - __size_; }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t __available() const { return __capacity_ - __size_; }
 
-  _LIBCPP_HIDE_FROM_ABI void __prepare_write(size_t __code_units) {
+  _LIBCPP_HIDE_FROM_ABI constexpr void __prepare_write(size_t __code_units) {
     // Always have space for one additional code unit. This is a precondition of the push_back function.
     __code_units += 1;
     if (__available() < __code_units)
diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h
index bb30e3bf771fcd..e1e95d13bef9b3 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -101,7 +101,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr __arg_t __get_packed_type(uint64_t __types, size
 // This function is not user observable, so it can directly use the non-standard
 // types of the "variant". See __arg_t for more details.
 template <class _Visitor, class _Context>
-_LIBCPP_HIDE_FROM_ABI decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
+_LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
   switch (__arg.__type_) {
   case __format::__arg_t::__none:
     return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__monostate_);
@@ -285,7 +285,7 @@ class _LIBCPP_NO_SPECIALIZATIONS basic_format_arg {
 public:
   class handle;
 
-  _LIBCPP_HIDE_FROM_ABI basic_format_arg() noexcept : __type_{__format::__arg_t::__none} {}
+  _LIBCPP_HIDE_FROM_ABI constexpr basic_format_arg() noexcept : __type_{__format::__arg_t::__none} {}
 
   _LIBCPP_HIDE_FROM_ABI explicit operator bool() const noexcept { return __type_ != __format::__arg_t::__none; }
 
@@ -353,7 +353,7 @@ class _LIBCPP_NO_SPECIALIZATIONS basic_format_arg {
   __basic_format_arg_value<_Context> __value_;
   __format::__arg_t __type_;
 
-  _LIBCPP_HIDE_FROM_ABI explicit basic_format_arg(__format::__arg_t __type,
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_format_arg(__format::__arg_t __type,
                                                   __basic_format_arg_value<_Context> __value) noexcept
       : __value_(__value), __type_(__type) {}
 };
diff --git a/libcxx/include/__format/format_arg_store.h b/libcxx/include/__format/format_arg_store.h
index 96398eab9c072b..3821d52002df38 100644
--- a/libcxx/include/__format/format_arg_store.h
+++ b/libcxx/include/__format/format_arg_store.h
@@ -169,7 +169,8 @@ consteval __arg_t __determine_arg_t() {
 // Modeled after template<class T> explicit basic_format_arg(T& v) noexcept;
 // [format.arg]/4-6
 template <class _Context, class _Tp>
-_LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> __create_format_arg(_Tp& __value) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr basic_format_arg<_Context> 
+__create_format_arg(_Tp& __value) noexcept {
   using _Dp               = remove_const_t<_Tp>;
   constexpr __arg_t __arg = __format::__determine_arg_t<_Context, _Dp>();
   static_assert(__arg != __arg_t::__none, "the supplied type is not formattable");
@@ -216,7 +217,7 @@ _LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> __create_format_arg(_Tp& __valu
 }
 
 template <class _Context, class... _Args>
-_LIBCPP_HIDE_FROM_ABI void
+_LIBCPP_HIDE_FROM_ABI constexpr void
 __create_packed_storage(uint64_t& __types, __basic_format_arg_value<_Context>* __values, _Args&... __args) noexcept {
   int __shift = 0;
   (
diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index eb7629f6bf5fe0..9db95423245ebc 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -93,7 +93,8 @@ class _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_
 #  endif
   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
   out() { return std::move(__out_it_); }
-  _LIBCPP_HIDE_FROM_ABI void advance_to(iterator __it) { __out_it_ = std::move(__it); }
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void 
+  advance_to(iterator __it) { __out_it_ = std::move(__it); }
 
 private:
   iterator __out_it_;
diff --git a/libcxx/include/__format/formatter_integer.h b/libcxx/include/__format/formatter_integer.h
index a0996704e1e2a4..5c60ee071c7b80 100644
--- a/libcxx/include/__format/formatter_integer.h
+++ b/libcxx/include/__format/formatter_integer.h
@@ -40,7 +40,8 @@ struct __formatter_integer {
   }
 
   template <integral _Tp, class _FormatContext>
-  _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(_Tp __value, _FormatContext& __ctx) const {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator 
+  format(_Tp __value, _FormatContext& __ctx) const {
     __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx);
 
     if (__specs.__std_.__type_ == __format_spec::__type::__char)
diff --git a/libcxx/include/__format/formatter_integral.h b/libcxx/include/__format/formatter_integral.h
index 35fb138c7dace6..706ceed11b199f 100644
--- a/libcxx/include/__format/formatter_integral.h
+++ b/libcxx/include/__format/formatter_integral.h
@@ -56,7 +56,8 @@ namespace __formatter {
 
 template <contiguous_iterator _Iterator>
   requires same_as<char, iter_value_t<_Iterator>>
-_LIBCPP_HIDE_FROM_ABI inline _Iterator __insert_sign(_Iterator __buf, bool __negative, __format_spec::__sign __sign) {
+_LIBCPP_HIDE_FROM_ABI constexpr inline _Iterator
+__insert_sign(_Iterator __buf, bool __negative, __format_spec::__sign __sign) {
   if (__negative)
     *__buf++ = '-';
   else
@@ -157,7 +158,7 @@ __format_char(integral auto __value,
 /** Wrapper around @ref to_chars, returning the output iterator. */
 template <contiguous_iterator _Iterator, integral _Tp>
   requires same_as<char, iter_value_t<_Iterator>>
-_LIBCPP_HIDE_FROM_ABI _Iterator __to_buffer(_Iterator __first, _Iterator __last, _Tp __value, int __base) {
+_LIBCPP_HIDE_FROM_ABI constexpr _Iterator __to_buffer(_Iterator __first, _Iterator __last, _Tp __value, int __base) {
   // TODO FMT Evaluate code overhead due to not calling the internal function
   // directly. (Should be zero overhead.)
   to_chars_result __r = std::to_chars(std::to_address(__first), std::to_address(__last), __value, __base);
@@ -226,7 +227,7 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(
                (__grouping.size() - 1); // number of separator characters
 
   __padding_size_result __padding = {0, 0};
-  if (__specs.__alignment_ == __format_spec::__alignment::__zero_padding) {
+  if (__specs.__std_.__alignment_ == __format_spec::__alignment::__zero_padding) {
     // Write [sign][prefix].
     __out_it = __formatter::__copy(__begin, __first, std::move(__out_it));
 
@@ -238,7 +239,7 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(
   } else {
     if (__specs.__width_ > __size) {
       // Determine padding and write padding.
-      __padding = __formatter::__padding_size(__size, __specs.__width_, __specs.__alignment_);
+      __padding = __formatter::__padding_size(__size, __specs.__width_, __specs.__std_.__alignment_);
 
       __out_it = __formatter::__fill(std::move(__out_it), __padding.__before_, __specs.__fill_);
     }
@@ -283,7 +284,7 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(
 
 template <unsigned_integral _Tp, contiguous_iterator _Iterator, class _CharT, class _FormatContext>
   requires same_as<char, iter_value_t<_Iterator>>
-_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator __format_integer(
+_LIBCPP_HIDE_FROM_ABI constexpr typename _FormatContext::iterator __format_integer(
     _Tp __value,
     _FormatContext& __ctx,
     __format_spec::__parsed_specifications<_CharT> __specs,
@@ -320,7 +321,7 @@ _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator __format_integer(
   }
 #  endif
   auto __out_it = __ctx.out();
-  if (__specs.__alignment_ != __format_spec::__alignment::__zero_padding)
+  if (__specs.__std_.__alignment_ != __format_spec::__alignment::__zero_padding)
     __first = __begin;
   else {
     // __buf contains [sign][prefix]data
@@ -328,10 +329,10 @@ _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator __format_integer(
     // The zero padding is done like:
     // - Write [sign][prefix]
     // - Write data right aligned with '0' as fill character.
-    __out_it                  = __formatter::__copy(__begin, __first, std::move(__out_it));
-    __specs.__alignment_      = __format_spec::__alignment::__right;
-    __specs.__fill_.__data[0] = _CharT('0');
-    int32_t __size            = __first - __begin;
+    __out_it                    = __formatter::__copy(__begin, __first, std::move(__out_it));
+    __specs.__std_.__alignment_ = __format_spec::__alignment::__right;
+    __specs.__fill_.__data[0]   = _CharT('0');
+    int32_t __size              = __first - __begin;
 
     __specs.__width_ -= std::min(__size, __specs.__width_);
   }
@@ -343,7 +344,7 @@ _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator __format_integer(
 }
 
 template <unsigned_integral _Tp, class _CharT, class _FormatContext>
-_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
+_LIBCPP_HIDE_FROM_ABI constexpr typename _FormatContext::iterator
 __format_integer(_Tp __value,
                  _FormatContext& __ctx,
                  __format_spec::__parsed_specifications<_CharT> __specs,
@@ -384,7 +385,7 @@ __format_integer(_Tp __value,
 }
 
 template <signed_integral _Tp, class _CharT, class _FormatContext>
-_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
+_LIBCPP_HIDE_FROM_ABI constexpr typename _FormatContext::iterator
 __format_integer(_Tp __value, _FormatContext& __ctx, __format_spec::__parsed_specifications<_CharT> __specs) {
   // Depending on the std-format-spec string the sign and the value
   // might not be outputted together:
diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h
index f4bcaac53f6a84..0a2b9e6895a73e 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -83,7 +83,7 @@ __padding_size(size_t __size, size_t __width, __format_spec::__alignment __align
 ///
 /// This uses a "mass output function" of __format::__output_buffer when possible.
 template <__fmt_char_type _CharT, __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
+_LIBCPP_HIDE_FROM_ABI constexpr auto
 __copy(basic_string_view<_CharT> __str, output_iterator<const _OutCharT&> auto __out_it) -> decltype(__out_it) {
   if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
     __out_it.__get_container()->__copy(__str);
@@ -99,16 +99,16 @@ __copy(basic_string_view<_CharT> __str, output_iterator<const _OutCharT&> auto _
 template <contiguous_iterator _Iterator,
           __fmt_char_type _CharT    = typename iterator_traits<_Iterator>::value_type,
           __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__copy(_Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it) -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto __copy(_Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it)
+    -> decltype(__out_it) {
   return __formatter::__copy(basic_string_view{__first, __last}, std::move(__out_it));
 }
 
 template <contiguous_iterator _Iterator,
           __fmt_char_type _CharT    = typename iterator_traits<_Iterator>::value_type,
           __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
-__copy(_Iterator __first, size_t __n, output_iterator<const _OutCharT&> auto __out_it) -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto __copy(_Iterator __first, size_t __n, output_iterator<const _OutCharT&> auto __out_it)
+    -> decltype(__out_it) {
   return __formatter::__copy(basic_string_view{std::to_address(__first), __n}, std::move(__out_it));
 }
 
@@ -119,11 +119,9 @@ template <contiguous_iterator _Iterator,
           __fmt_char_type _CharT    = typename iterator_traits<_Iterator>::value_type,
           __fmt_char_type _OutCharT = _CharT,
           class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI auto
-__transform(_Iterator __first,
-            _Iterator __last,
-            output_iterator<const _OutCharT&> auto __out_it,
-            _UnaryOperation __operation) -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto __transform(
+    _Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it, _UnaryOperation __operation)
+    -> decltype(__out_it) {
   if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
     __out_it.__get_container()->__transform(__first, __last, std::move(__operation));
     return __out_it;
@@ -209,7 +207,7 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::
 /// conversion, which means the [\a __first, \a __last) always contains elements
 /// of the type \c char.
 template <class _CharT, class _ParserCharT>
-_LIBCPP_HIDE_FROM_ABI auto
+_LIBCPP_HIDE_FROM_ABI constexpr auto
 __write(basic_string_view<_CharT> __str,
         output_iterator<const _CharT&> auto __out_it,
         __format_spec::__parsed_specifications<_ParserCharT> __specs,
@@ -224,7 +222,7 @@ __write(basic_string_view<_CharT> __str,
 }
 
 template <contiguous_iterator _Iterator, class _ParserCharT>
-_LIBCPP_HIDE_FROM_ABI auto
+_LIBCPP_HIDE_FROM_ABI constexpr auto
 __write(_Iterator __first,
         _Iterator __last,
         output_iterator<const iter_value_t<_Iterator>&> auto __out_it,
@@ -238,7 +236,7 @@ __write(_Iterator __first,
 ///
 /// Calls the function above where \a __size = \a __last - \a __first.
 template <contiguous_iterator _Iterator, class _ParserCharT>
-_LIBCPP_HIDE_FROM_ABI auto
+_LIBCPP_HIDE_FROM_ABI constexpr auto
 __write(_Iterator __first,
         _Iterator __last,
         output_iterator<const iter_value_t<_Iterator>&> auto __out_it,
@@ -263,7 +261,7 @@ _LIBCPP_HIDE_FROM_ABI auto __write_transformed(
   if (__size >= __specs.__width_)
     return __formatter::__transform(__first, __last, std::move(__out_it), __op);
 
-  __padding_size_result __padding = __formatter::__padding_size(__size, __specs.__width_, __specs.__alignment_);
+  __padding_size_result __padding = __formatter::__padding_size(__size, __specs.__width_, __specs.__std_.__alignment_);
   __out_it                        = __formatter::__fill(std::move(__out_it), __padding.__before_, __specs.__fill_);
   __out_it                        = __formatter::__transform(__first, __last, std::move(__out_it), __op);
   return __formatter::__fill(std::move(__out_it), __padding.__after_, __specs.__fill_);
diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h
index 822dfce2c365b0..9a772999ad0ecb 100644
--- a/libcxx/include/__format/parser_std_format_spec.h
+++ b/libcxx/include/__format/parser_std_format_spec.h
@@ -454,7 +454,7 @@ class __parser : public __parser_data<_CharT> {
   }
 
   /// \returns the `__parsed_specifications` with the resolved dynamic sizes..
-  _LIBCPP_HIDE_FROM_ABI __parsed_specifications<_CharT> __get_parsed_std_specifications(auto& __ctx) const {
+  _LIBCPP_HIDE_FROM_ABI constexpr __parsed_specifications<_CharT> __get_parsed_std_specifications(auto& __ctx) const {
     return __parsed_specifications<_CharT>{
         .__std_ = __std{.__alignment_            = __alignment_,
                         .__sign_                 = __sign_,
@@ -784,14 +784,14 @@ class __parser : public __parser_data<_CharT> {
     ++__begin;
   }
 
-  _LIBCPP_HIDE_FROM_ABI int32_t __get_width(auto& __ctx) const {
+  _LIBCPP_HIDE_FROM_ABI constexpr int32_t __get_width(auto& __ctx) const {
     if (!__width_as_arg_)
       return __width_;
 
     return __format_spec::__substitute_arg_id(__ctx.arg(__width_));
   }
 
-  _LIBCPP_HIDE_FROM_ABI int32_t __get_precision(auto& __ctx) const {
+  _LIBCPP_HIDE_FROM_ABI constexpr int32_t __get_precision(auto& __ctx) const {
     if (!__precision_as_arg_)
       return __precision_;
 

>From f3be6b80689230b1b2a207e5ef79f52dfda00d95 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Mon, 12 Oct 2026 20:03:02 +0200
Subject: [PATCH 17/46] update: enable 2 working tests

---
 .../format/format.functions/format.constexpr.pass.cpp       | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
index 493f61864afc41..63dec6b45e8183 100644
--- a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
@@ -28,9 +28,9 @@ constexpr bool test() {
 
   // Integers
   assert(std::format("{}", 42) == "42");
-  assert(std::format("{}", 42, 3.0) == "42");  // 3.0 is stored but never formatted
-  // assert(std::format("{}", -42) == "-42");
-  // assert(std::format("{:x}", 255u) == "ff");
+  assert(std::format("{}", 42, 3.0) == "42"); // 3.0 is stored but never formatted
+  assert(std::format("{}", -42) == "-42");
+  assert(std::format("{:x}", 255u) == "ff");
   // assert(std::format("{:>5}", 42) == "   42");
 
   // bool and char

>From e6055ee77ef7bf86a0c7ccfe468ee4414841c5dd Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Mon, 12 Oct 2026 20:47:43 +0200
Subject: [PATCH 18/46] fix: revert undesired clang-format changes

---
 libcxx/include/__format/format_context.h   |  1 -
 libcxx/include/__format/format_functions.h | 24 +++++++++++-----------
 libcxx/include/__format/formatter_output.h | 16 ++++++++-------
 3 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index 9db95423245ebc..cff32ccfddaad5 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -10,7 +10,6 @@
 #ifndef _LIBCPP___FORMAT_FORMAT_CONTEXT_H
 #define _LIBCPP___FORMAT_FORMAT_CONTEXT_H
 
-#include "__configuration/language.h"
 #include <__concepts/same_as.h>
 #include <__config>
 #include <__cstddef/size_t.h>
diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index 1f7febdfddbb0e..7dec2633ae6451 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -626,22 +626,22 @@ vformat_to(_OutIt __out_it, locale __loc, string_view __fmt, format_args __args)
 
 #    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt>
-_LIBCPP_ALWAYS_INLINE
-_LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(_OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) {
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
+vformat_to(_OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) {
   return std::__vformat_to(std::move(__out_it), std::move(__loc), __fmt, __args);
 }
 #    endif
 
 template <output_iterator<const char&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI
-_OutIt format_to(_OutIt __out_it, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
+format_to(_OutIt __out_it, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(), std::make_format_args(__args...));
 }
 
 #    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <output_iterator<const wchar_t&> _OutIt, class... _Args>
-_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI
-_OutIt format_to(_OutIt __out_it, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
+_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt
+format_to(_OutIt __out_it, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat_to(std::move(__out_it), std::move(__loc), __fmt.get(), std::make_wformat_args(__args...));
 }
 #    endif
@@ -669,15 +669,15 @@ vformat(locale __loc, wstring_view __fmt, wformat_args __args) {
 #    endif
 
 template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE
-_LIBCPP_HIDE_FROM_ABI string format(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
+[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string
+format(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat(std::move(__loc), __fmt.get(), std::make_format_args(__args...));
 }
 
 #    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE
-_LIBCPP_HIDE_FROM_ABI wstring format(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
+[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring
+format(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
   return std::vformat(std::move(__loc), __fmt.get(), std::make_wformat_args(__args...));
 }
 #    endif
@@ -729,8 +729,8 @@ formatted_size(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) {
 
 #    if _LIBCPP_HAS_WIDE_CHARACTERS
 template <class... _Args>
-[[nodiscard]] _LIBCPP_ALWAYS_INLINE
-_LIBCPP_HIDE_FROM_ABI size_t formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
+[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t
+formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) {
   return std::__vformatted_size(std::move(__loc), __fmt.get(), basic_format_args{std::make_wformat_args(__args...)});
 }
 #    endif
diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h
index 0a2b9e6895a73e..3b4233068a993b 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -99,16 +99,16 @@ __copy(basic_string_view<_CharT> __str, output_iterator<const _OutCharT&> auto _
 template <contiguous_iterator _Iterator,
           __fmt_char_type _CharT    = typename iterator_traits<_Iterator>::value_type,
           __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __copy(_Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it)
-    -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto
+__copy(_Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it) -> decltype(__out_it) {
   return __formatter::__copy(basic_string_view{__first, __last}, std::move(__out_it));
 }
 
 template <contiguous_iterator _Iterator,
           __fmt_char_type _CharT    = typename iterator_traits<_Iterator>::value_type,
           __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __copy(_Iterator __first, size_t __n, output_iterator<const _OutCharT&> auto __out_it)
-    -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto
+__copy(_Iterator __first, size_t __n, output_iterator<const _OutCharT&> auto __out_it) -> decltype(__out_it) {
   return __formatter::__copy(basic_string_view{std::to_address(__first), __n}, std::move(__out_it));
 }
 
@@ -119,9 +119,11 @@ template <contiguous_iterator _Iterator,
           __fmt_char_type _CharT    = typename iterator_traits<_Iterator>::value_type,
           __fmt_char_type _OutCharT = _CharT,
           class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI auto __transform(
-    _Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it, _UnaryOperation __operation)
-    -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI auto
+__transform(_Iterator __first,
+            _Iterator __last,
+            output_iterator<const _OutCharT&> auto __out_it,
+            _UnaryOperation __operation) -> decltype(__out_it) {
   if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
     __out_it.__get_container()->__transform(__first, __last, std::move(__operation));
     return __out_it;

>From 86c5dd7d59423b4bc40faea6b22e627a93403884 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Mon, 12 Oct 2026 20:49:13 +0200
Subject: [PATCH 19/46] fix: clang-format

---
 libcxx/include/__format/format_arg.h        | 12 +++++++-----
 libcxx/include/__format/format_arg_store.h  |  3 +--
 libcxx/include/__format/format_context.h    | 15 ++++++---------
 libcxx/include/__format/formatter_integer.h |  2 +-
 4 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h
index e1e95d13bef9b3..7b6e88491d4cf6 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -253,7 +253,7 @@ class __basic_format_arg_value {
 
   // These constructors contain the exact storage type used. If adjustments are
   // required, these will be done in __create_format_arg.
-  // 
+  //
   // P3391R2: make_format_args and the basic_format_arg constructors constexpr for every argument type.
   // An argument is stored even when the format string never uses it, e.g. std::format("{}", 42, 3.0).
   // Only formatting floating-point and pointer values remains non-constant as the paper defines it.
@@ -273,11 +273,13 @@ class __basic_format_arg_value {
   _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(float __value) noexcept : __float_(__value) {}
   _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(double __value) noexcept : __double_(__value) {}
   _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(long double __value) noexcept : __long_double_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(const _CharT* __value) noexcept : __const_char_type_ptr_(__value) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(const _CharT* __value) noexcept
+      : __const_char_type_ptr_(__value) {}
   _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(basic_string_view<_CharT> __value) noexcept
       : __string_view_(__value) {}
   _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(const void* __value) noexcept : __ptr_(__value) {}
-  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(__handle&& __value) noexcept : __handle_(std::move(__value)) {}
+  _LIBCPP_HIDE_FROM_ABI constexpr __basic_format_arg_value(__handle&& __value) noexcept
+      : __handle_(std::move(__value)) {}
 };
 
 template <class _Context>
@@ -353,8 +355,8 @@ class _LIBCPP_NO_SPECIALIZATIONS basic_format_arg {
   __basic_format_arg_value<_Context> __value_;
   __format::__arg_t __type_;
 
-  _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_format_arg(__format::__arg_t __type,
-                                                  __basic_format_arg_value<_Context> __value) noexcept
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_format_arg(
+      __format::__arg_t __type, __basic_format_arg_value<_Context> __value) noexcept
       : __value_(__value), __type_(__type) {}
 };
 
diff --git a/libcxx/include/__format/format_arg_store.h b/libcxx/include/__format/format_arg_store.h
index 3821d52002df38..ad6e46ea27397c 100644
--- a/libcxx/include/__format/format_arg_store.h
+++ b/libcxx/include/__format/format_arg_store.h
@@ -169,8 +169,7 @@ consteval __arg_t __determine_arg_t() {
 // Modeled after template<class T> explicit basic_format_arg(T& v) noexcept;
 // [format.arg]/4-6
 template <class _Context, class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr basic_format_arg<_Context> 
-__create_format_arg(_Tp& __value) noexcept {
+_LIBCPP_HIDE_FROM_ABI constexpr basic_format_arg<_Context> __create_format_arg(_Tp& __value) noexcept {
   using _Dp               = remove_const_t<_Tp>;
   constexpr __arg_t __arg = __format::__determine_arg_t<_Context, _Dp>();
   static_assert(__arg != __arg_t::__none, "the supplied type is not formattable");
diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index cff32ccfddaad5..e1c6ebe217f400 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -90,10 +90,8 @@ class _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_
     return *__loc_;
   }
 #  endif
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator
-  out() { return std::move(__out_it_); }
-  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void 
-  advance_to(iterator __it) { __out_it_ = std::move(__it); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator out() { return std::move(__out_it_); }
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void advance_to(iterator __it) { __out_it_ = std::move(__it); }
 
 private:
   iterator __out_it_;
@@ -112,17 +110,16 @@ class _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_
   optional<std::locale> __loc_;
 
   template <class _OtherOutIt, class _OtherCharT>
-  friend _LIBCPP_HIDE_FROM_ABI constexpr basic_format_context<_OtherOutIt, _OtherCharT> 
-__format_context_create(
+  friend _LIBCPP_HIDE_FROM_ABI constexpr basic_format_context<_OtherOutIt, _OtherCharT> __format_context_create(
       _OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>, optional<std::locale>&&);
 
   // Note: the Standard doesn't specify the required constructors.
-  _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR_SINCE_CXX26 basic_format_context(
-      _OutIt __out_it, basic_format_args<basic_format_context> __args, optional<std::locale>&& __loc)
+  _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR_SINCE_CXX26
+  basic_format_context(_OutIt __out_it, basic_format_args<basic_format_context> __args, optional<std::locale>&& __loc)
       : __out_it_(std::move(__out_it)), __args_(__args), __loc_(std::move(__loc)) {}
 #  else
   template <class _OtherOutIt, class _OtherCharT>
-  friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26  basic_format_context<_OtherOutIt, _OtherCharT>
+  friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 basic_format_context<_OtherOutIt, _OtherCharT>
       __format_context_create(_OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>);
 
   _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR_SINCE_CXX26
diff --git a/libcxx/include/__format/formatter_integer.h b/libcxx/include/__format/formatter_integer.h
index 5c60ee071c7b80..dd00d3770d814c 100644
--- a/libcxx/include/__format/formatter_integer.h
+++ b/libcxx/include/__format/formatter_integer.h
@@ -40,7 +40,7 @@ struct __formatter_integer {
   }
 
   template <integral _Tp, class _FormatContext>
-  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator 
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator
   format(_Tp __value, _FormatContext& __ctx) const {
     __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx);
 

>From ed046690f4b0cc3e455b9dca8268ef448a40167c Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Mon, 12 Oct 2026 20:51:34 +0200
Subject: [PATCH 20/46] add: constexpr-since-cxx26 to __format_context_create

---
 libcxx/include/__format/format_context.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index e1c6ebe217f400..11c6b19ca0bf19 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -110,7 +110,7 @@ class _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_
   optional<std::locale> __loc_;
 
   template <class _OtherOutIt, class _OtherCharT>
-  friend _LIBCPP_HIDE_FROM_ABI constexpr basic_format_context<_OtherOutIt, _OtherCharT> __format_context_create(
+  friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr basic_format_context<_OtherOutIt, _OtherCharT> __format_context_create(
       _OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>, optional<std::locale>&&);
 
   // Note: the Standard doesn't specify the required constructors.

>From 87353bb516e5dd1f4dd0490de722ab1cb969d29c Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Mon, 12 Oct 2026 20:55:31 +0200
Subject: [PATCH 21/46] fix: __format_context_create

---
 libcxx/include/__format/format_context.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index 11c6b19ca0bf19..1899aba6e3c6ed 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -110,7 +110,7 @@ class _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_
   optional<std::locale> __loc_;
 
   template <class _OtherOutIt, class _OtherCharT>
-  friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 constexpr basic_format_context<_OtherOutIt, _OtherCharT> __format_context_create(
+  friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 basic_format_context<_OtherOutIt, _OtherCharT> __format_context_create(
       _OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>, optional<std::locale>&&);
 
   // Note: the Standard doesn't specify the required constructors.

>From c5a29eeb14afa30a5121c3212d1c00f5e7d45539 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Mon, 12 Oct 2026 22:07:20 +0200
Subject: [PATCH 22/46] update: format_context

---
 libcxx/include/__format/format_context.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index 1899aba6e3c6ed..a849f9e733bb5a 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -110,7 +110,8 @@ class _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_
   optional<std::locale> __loc_;
 
   template <class _OtherOutIt, class _OtherCharT>
-  friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 basic_format_context<_OtherOutIt, _OtherCharT> __format_context_create(
+  friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 basic_format_context<_OtherOutIt, _OtherCharT>
+  __format_context_create(
       _OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>, optional<std::locale>&&);
 
   // Note: the Standard doesn't specify the required constructors.

>From 8a763006ef122555130071bdaf91b586e7743fa4 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Tue, 13 Oct 2026 16:19:21 +0200
Subject: [PATCH 23/46] add: constexpr to __fill functions

---
 libcxx/include/__format/formatter_output.h                    | 4 ++--
 .../format/format.functions/format.constexpr.pass.cpp         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h
index 3b4233068a993b..a169ae343ed052 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -139,7 +139,7 @@ __transform(_Iterator __first,
 ///
 /// This uses a "mass output function" of __format::__output_buffer when possible.
 template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
-_LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, _CharT __value) {
+_LIBCPP_HIDE_FROM_ABI constexpr _OutIt __fill(_OutIt __out_it, size_t __n, _CharT __value) {
   if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_CharT>>>) {
     __out_it.__get_container()->__fill(__n, __value);
     return __out_it;
@@ -152,7 +152,7 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, _CharT __value)
 }
 
 template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
-_LIBCPP_HIDE_FROM_ABI _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
+_LIBCPP_HIDE_FROM_ABI constexpr _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
 #  if _LIBCPP_HAS_UNICODE
   if constexpr (same_as<_CharT, char>) {
     std::size_t __bytes = std::countl_one(static_cast<unsigned char>(__value.__data[0]));
diff --git a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
index 63dec6b45e8183..81637e0833a56b 100644
--- a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
@@ -31,7 +31,7 @@ constexpr bool test() {
   assert(std::format("{}", 42, 3.0) == "42"); // 3.0 is stored but never formatted
   assert(std::format("{}", -42) == "-42");
   assert(std::format("{:x}", 255u) == "ff");
-  // assert(std::format("{:>5}", 42) == "   42");
+  assert(std::format("{:>5}", 42) == "   42");
 
   // bool and char
   // assert(std::format("{}", true) == "true");

>From 3db6a4da79af839fde78e7aa64386a138d405d37 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Tue, 13 Oct 2026 16:39:50 +0200
Subject: [PATCH 24/46] constexpr: bool and char tests working

---
 libcxx/include/__format/formatter_bool.h               | 10 ++++++----
 libcxx/include/__format/formatter_bool_impl.h          |  2 +-
 libcxx/include/__format/formatter_char.h               |  3 ++-
 libcxx/include/__format/formatter_integral.h           |  4 ++--
 .../format/format.functions/format.constexpr.pass.cpp  |  4 ++--
 5 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/libcxx/include/__format/formatter_bool.h b/libcxx/include/__format/formatter_bool.h
index 139917c1e29e53..febc119d849e0b 100644
--- a/libcxx/include/__format/formatter_bool.h
+++ b/libcxx/include/__format/formatter_bool.h
@@ -24,22 +24,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 #if _LIBCPP_STD_VER >= 20
 
 template <__fmt_char_type _CharT, class _ParseContext>
-_LIBCPP_HIDE_FROM_ABI constexpr
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
     typename _ParseContext::iterator __formatter_bool_parse(__format_spec::__parser_data<_CharT>&, _ParseContext&);
 
 template <__fmt_char_type _CharT, class _FormatContext>
-_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator
 __formatter_bool_format(bool __value, __format_spec::__parser_data<_CharT>, _FormatContext&);
 
 template <__fmt_char_type _CharT>
 struct formatter<bool, _CharT> {
   template <class _ParseContext>
-  _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _ParseContext::iterator 
+  parse(_ParseContext& __ctx) {
     return std::__formatter_bool_parse(__parser_, __ctx);
   }
 
   template <class _FormatContext>
-  _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(bool __value, _FormatContext& __ctx) const {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator 
+  format(bool __value, _FormatContext& __ctx) const {
     return std::__formatter_bool_format(__value, __parser_, __ctx);
   }
 
diff --git a/libcxx/include/__format/formatter_bool_impl.h b/libcxx/include/__format/formatter_bool_impl.h
index 477ef39feedd6e..35645452135cc3 100644
--- a/libcxx/include/__format/formatter_bool_impl.h
+++ b/libcxx/include/__format/formatter_bool_impl.h
@@ -41,7 +41,7 @@ __formatter_bool_parse(__format_spec::__parser_data<_CharT>& __parser_data, _Par
 }
 
 template <__fmt_char_type _CharT, class _FormatContext>
-_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
+_LIBCPP_HIDE_FROM_ABI constexpr typename _FormatContext::iterator
 __formatter_bool_format(bool __value, __format_spec::__parser_data<_CharT> __parser_data, _FormatContext& __ctx) {
   __format_spec::__parser<_CharT> __parser(__parser_data);
 
diff --git a/libcxx/include/__format/formatter_char.h b/libcxx/include/__format/formatter_char.h
index 919c5b7b9f9f94..137f70d4501ba3 100644
--- a/libcxx/include/__format/formatter_char.h
+++ b/libcxx/include/__format/formatter_char.h
@@ -41,7 +41,8 @@ struct __formatter_char {
   }
 
   template <class _FormatContext>
-  _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(_CharT __value, _FormatContext& __ctx) const {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator 
+  format(_CharT __value, _FormatContext& __ctx) const {
     if (__parser_.__type_ == __format_spec::__type::__default || __parser_.__type_ == __format_spec::__type::__char)
       return __formatter::__format_char(__value, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx));
 
diff --git a/libcxx/include/__format/formatter_integral.h b/libcxx/include/__format/formatter_integral.h
index 706ceed11b199f..7c09df6da6cca8 100644
--- a/libcxx/include/__format/formatter_integral.h
+++ b/libcxx/include/__format/formatter_integral.h
@@ -126,7 +126,7 @@ _LIBCPP_HIDE_FROM_ABI inline string __determine_grouping(ptrdiff_t __size, const
 //
 
 template <__fmt_char_type _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
+_LIBCPP_HIDE_FROM_ABI constexpr auto
 __format_char(integral auto __value,
               output_iterator<const _CharT&> auto __out_it,
               __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
@@ -423,7 +423,7 @@ struct __bool_strings<wchar_t> {
 #  endif
 
 template <class _CharT, class _FormatContext>
-_LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
+_LIBCPP_HIDE_FROM_ABI constexpr typename _FormatContext::iterator
 __format_bool(bool __value, _FormatContext& __ctx, __format_spec::__parsed_specifications<_CharT> __specs) {
 #  if _LIBCPP_HAS_LOCALIZATION
   if (__specs.__std_.__locale_specific_form_) {
diff --git a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
index 81637e0833a56b..752935ef33f153 100644
--- a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
@@ -34,8 +34,8 @@ constexpr bool test() {
   assert(std::format("{:>5}", 42) == "   42");
 
   // bool and char
-  // assert(std::format("{}", true) == "true");
-  // assert(std::format("{}", 'a') == "a");
+  assert(std::format("{}", true) == "true");
+  assert(std::format("{}", 'a') == "a");
 
   // Strings
   // assert(std::format("{}", "abc") == "abc");

>From d090935d358b572b424fe468aa0f6dd10bab2193 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Tue, 13 Oct 2026 16:46:51 +0200
Subject: [PATCH 25/46] test: first format string test passing

---
 libcxx/include/__format/formatter_output.h                    | 2 +-
 libcxx/include/__format/formatter_string.h                    | 4 ++--
 libcxx/include/__format/write_escaped.h                       | 2 +-
 .../format/format.functions/format.constexpr.pass.cpp         | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h
index a169ae343ed052..68b1fb5d196b06 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -275,7 +275,7 @@ _LIBCPP_HIDE_FROM_ABI auto __write_transformed(
 ///
 /// \note When \c _LIBCPP_HAS_UNICODE is false the function assumes the input is ASCII.
 template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI auto __write_string_no_precision(
+_LIBCPP_HIDE_FROM_ABI constexpr auto __write_string_no_precision(
     basic_string_view<_CharT> __str,
     output_iterator<const _CharT&> auto __out_it,
     __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
diff --git a/libcxx/include/__format/formatter_string.h b/libcxx/include/__format/formatter_string.h
index 548a27d952588d..11aeef252bcaec 100644
--- a/libcxx/include/__format/formatter_string.h
+++ b/libcxx/include/__format/formatter_string.h
@@ -41,7 +41,7 @@ struct __formatter_string {
   }
 
   template <class _FormatContext>
-  _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator
   format(basic_string_view<_CharT> __str, _FormatContext& __ctx) const {
 #  if _LIBCPP_STD_VER >= 23
     if (__parser_.__type_ == __format_spec::__type::__debug)
@@ -122,7 +122,7 @@ struct formatter<basic_string_view<_CharT, _Traits>, _CharT> : public __formatte
   using _Base _LIBCPP_NODEBUG = __formatter_string<_CharT>;
 
   template <class _FormatContext>
-  _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator
   format(basic_string_view<_CharT, _Traits> __str, _FormatContext& __ctx) const {
     // Drop _Traits to have one std::basic_string_view formatter.
     return _Base::format(basic_string_view<_CharT>(__str.data(), __str.size()), __ctx);
diff --git a/libcxx/include/__format/write_escaped.h b/libcxx/include/__format/write_escaped.h
index aa74940032f786..c6b8add5cfabae 100644
--- a/libcxx/include/__format/write_escaped.h
+++ b/libcxx/include/__format/write_escaped.h
@@ -44,7 +44,7 @@ namespace __formatter {
 ///
 /// \note When \c _LIBCPP_HAS_UNICODE is false the function assumes the input is ASCII.
 template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
+_LIBCPP_HIDE_FROM_ABI constexpr auto
 __write_string(basic_string_view<_CharT> __str,
                output_iterator<const _CharT&> auto __out_it,
                __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) {
diff --git a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
index 752935ef33f153..8f26a2c57b4615 100644
--- a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
@@ -38,7 +38,7 @@ constexpr bool test() {
   assert(std::format("{}", 'a') == "a");
 
   // Strings
-  // assert(std::format("{}", "abc") == "abc");
+  assert(std::format("{}", "abc") == "abc");
   //  assert(std::format("{}", std::string_view{"abc"}) == "abc");
   //  assert(std::format("{:*^7}", "abc") == "**abc**");
 

>From 41dcbb534e06cee36ad577d3d7dd5b874b41e81f Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Tue, 13 Oct 2026 16:48:24 +0200
Subject: [PATCH 26/46] tests: all Strings tests passing so far

---
 .../format/format.functions/format.constexpr.pass.cpp         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
index 8f26a2c57b4615..eb40251962193a 100644
--- a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
@@ -39,8 +39,8 @@ constexpr bool test() {
 
   // Strings
   assert(std::format("{}", "abc") == "abc");
-  //  assert(std::format("{}", std::string_view{"abc"}) == "abc");
-  //  assert(std::format("{:*^7}", "abc") == "**abc**");
+  assert(std::format("{}", std::string_view{"abc"}) == "abc");
+  assert(std::format("{:*^7}", "abc") == "**abc**");
 
   // Several arguments
   // assert(std::format("{} + {} = {}", 1, 2, 3) == "1 + 2 = 3");

>From 1775b58239c63deb35f96480ade48ba7f29fcbbd Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Tue, 13 Oct 2026 16:49:13 +0200
Subject: [PATCH 27/46] tests: all tests from format.constexpr.pass.cpp passing

---
 .../format/format.functions/format.constexpr.pass.cpp         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
index eb40251962193a..eb919815607186 100644
--- a/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/format.constexpr.pass.cpp
@@ -43,10 +43,10 @@ constexpr bool test() {
   assert(std::format("{:*^7}", "abc") == "**abc**");
 
   // Several arguments
-  // assert(std::format("{} + {} = {}", 1, 2, 3) == "1 + 2 = 3");
+  assert(std::format("{} + {} = {}", 1, 2, 3) == "1 + 2 = 3");
 
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
-  // assert(std::format(L"{}", 42) == L"42");
+  assert(std::format(L"{}", 42) == L"42");
 #endif
 
   return true;

>From 21e55c945b0103b5297cc8a51f29384a32bd3674 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Tue, 13 Oct 2026 16:55:43 +0200
Subject: [PATCH 28/46] fix: basic_format_arg formatting

---
 libcxx/include/__format/format_arg.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h
index 7b6e88491d4cf6..ca39d9cbba4e27 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -355,8 +355,8 @@ class _LIBCPP_NO_SPECIALIZATIONS basic_format_arg {
   __basic_format_arg_value<_Context> __value_;
   __format::__arg_t __type_;
 
-  _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_format_arg(
-      __format::__arg_t __type, __basic_format_arg_value<_Context> __value) noexcept
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit
+  basic_format_arg(__format::__arg_t __type, __basic_format_arg_value<_Context> __value) noexcept
       : __value_(__value), __type_(__type) {}
 };
 

>From 55f1ced303aba7394b3adb467f9c63a423b82eea Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Tue, 13 Oct 2026 18:32:36 +0200
Subject: [PATCH 29/46] fix: test updates. Some still failing for < C++23

---
 .../format/format.functions/format.pass.cpp   |  2 ++
 .../format/format.functions/format_tests.h    | 36 ++++++++++++-------
 .../format/format.tuple/format.pass.cpp       | 14 ++++++++
 3 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/libcxx/test/std/utilities/format/format.functions/format.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.pass.cpp
index 5ec244c4f8b311..28ffcd13d9e0ca 100644
--- a/libcxx/test/std/utilities/format/format.functions/format.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/format.pass.cpp
@@ -37,6 +37,8 @@ auto test =
     []<class CharT, class... Args>(
         std::basic_string_view<CharT> expected, test_format_string<CharT, Args...> fmt, Args&&... args) constexpr {
       std::basic_string<CharT> out = std::format(fmt, std::forward<Args>(args)...);
+      if (TEST_IS_CONSTANT_EVALUATED)
+        assert(out == expected);
       TEST_REQUIRE(
           out == expected,
           TEST_WRITE_CONCATENATED(
diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h
index 4cba83afd429c1..b0d73bbb5c221c 100644
--- a/libcxx/test/std/utilities/format/format.functions/format_tests.h
+++ b/libcxx/test/std/utilities/format/format.functions/format_tests.h
@@ -472,7 +472,8 @@ void format_test_buffer_full(TestFunction check) {
 // Using a const ref for world and universe so a string literal will be a character array.
 // When passed as character array W and U have different types.
 template <class CharT, class W, class U, class TestFunction, class ExceptionTest>
-void format_test_string(const W& world, const U& universe, TestFunction check, ExceptionTest check_exception) {
+TEST_CONSTEXPR_CXX26 void 
+format_test_string(const W& world, const U& universe, TestFunction check, ExceptionTest check_exception) {
 
   // *** Valid input tests ***
   // Unused argument is ignored. TODO FMT what does the Standard mandate?
@@ -594,7 +595,7 @@ void format_test_string(const W& world, const U& universe, TestFunction check, E
 }
 
 template <class CharT, class TestFunction>
-void format_test_string_unicode([[maybe_unused]] TestFunction check) {
+TEST_CONSTEXPR_CXX26 void format_test_string_unicode([[maybe_unused]] TestFunction check) {
   // unicode.pass.cpp and ascii.pass.cpp have additional tests.
 #ifndef TEST_HAS_NO_UNICODE
   // Make sure all possible types are tested. For clarity don't use macros.
@@ -689,7 +690,7 @@ void format_test_string_unicode([[maybe_unused]] TestFunction check) {
 }
 
 template <class CharT, class TestFunction, class ExceptionTest>
-void format_string_tests(TestFunction check, ExceptionTest check_exception) {
+TEST_CONSTEXPR_CXX26 void format_string_tests(TestFunction check, ExceptionTest check_exception) {
   std::basic_string<CharT> world = STR("world");
   std::basic_string<CharT> universe = STR("universe");
 
@@ -711,7 +712,7 @@ void format_string_tests(TestFunction check, ExceptionTest check_exception) {
 }
 
 template <class CharT, class TestFunction, class ExceptionTest>
-void format_test_bool(TestFunction check, ExceptionTest check_exception) {
+TEST_CONSTEXPR_CXX26 void format_test_bool(TestFunction check, ExceptionTest check_exception) {
 
   // *** align-fill & width ***
   check(SV("answer is 'true   '"), SV("answer is '{:7}'"), true);
@@ -768,7 +769,7 @@ void format_test_bool(TestFunction check, ExceptionTest check_exception) {
 }
 
 template <class CharT, class TestFunction, class ExceptionTest>
-void format_test_bool_as_integer(TestFunction check, ExceptionTest check_exception) {
+TEST_CONSTEXPR_CXX26 void format_test_bool_as_integer(TestFunction check, ExceptionTest check_exception) {
   // *** align-fill & width ***
   check(SV("answer is '1'"), SV("answer is '{:<1d}'"), true);
   check(SV("answer is '1 '"), SV("answer is '{:<2d}'"), true);
@@ -855,7 +856,7 @@ void format_test_bool_as_integer(TestFunction check, ExceptionTest check_excepti
 }
 
 template <class I, class CharT, class TestFunction, class ExceptionTest>
-void format_test_integer_as_integer(TestFunction check, ExceptionTest check_exception) {
+TEST_CONSTEXPR_CXX26 void format_test_integer_as_integer(TestFunction check, ExceptionTest check_exception) {
   // *** align-fill & width ***
   check(SV("answer is '42'"), SV("answer is '{:<1}'"), I(42));
   check(SV("answer is '42'"), SV("answer is '{:<2}'"), I(42));
@@ -992,7 +993,7 @@ void format_test_integer_as_integer(TestFunction check, ExceptionTest check_exce
 }
 
 template <class I, class CharT, class TestFunction, class ExceptionTest>
-void format_test_integer_as_char(TestFunction check, ExceptionTest check_exception) {
+TEST_CONSTEXPR_CXX26 void format_test_integer_as_char(TestFunction check, ExceptionTest check_exception) {
   // *** align-fill & width ***
   check(SV("answer is '*     '"), SV("answer is '{:6c}'"), I(42));
   check(SV("answer is '     *'"), SV("answer is '{:>6c}'"), I(42));
@@ -1050,13 +1051,13 @@ void format_test_integer_as_char(TestFunction check, ExceptionTest check_excepti
 }
 
 template <class I, class CharT, class TestFunction, class ExceptionTest>
-void format_test_integer(TestFunction check, ExceptionTest check_exception) {
+TEST_CONSTEXPR_CXX26 void format_test_integer(TestFunction check, ExceptionTest check_exception) {
   format_test_integer_as_integer<I, CharT>(check, check_exception);
   format_test_integer_as_char<I, CharT>(check, check_exception);
 }
 
 template <class CharT, class TestFunction, class ExceptionTest>
-void format_test_signed_integer(TestFunction check, ExceptionTest check_exception) {
+TEST_CONSTEXPR_CXX26 void format_test_signed_integer(TestFunction check, ExceptionTest check_exception) {
   format_test_integer<signed char, CharT>(check, check_exception);
   format_test_integer<short, CharT>(check, check_exception);
   format_test_integer<int, CharT>(check, check_exception);
@@ -1132,7 +1133,7 @@ void format_test_signed_integer(TestFunction check, ExceptionTest check_exceptio
 }
 
 template <class CharT, class TestFunction, class ExceptionTest>
-void format_test_unsigned_integer(TestFunction check, ExceptionTest check_exception) {
+TEST_CONSTEXPR_CXX26 void format_test_unsigned_integer(TestFunction check, ExceptionTest check_exception) {
   format_test_integer<unsigned char, CharT>(check, check_exception);
   format_test_integer<unsigned short, CharT>(check, check_exception);
   format_test_integer<unsigned, CharT>(check, check_exception);
@@ -1176,7 +1177,7 @@ void format_test_unsigned_integer(TestFunction check, ExceptionTest check_except
 }
 
 template <class CharT, class TestFunction, class ExceptionTest>
-void format_test_char(TestFunction check, ExceptionTest check_exception) {
+TEST_CONSTEXPR_CXX26 void format_test_char(TestFunction check, ExceptionTest check_exception) {
 
   // ***** Char type *****
   // *** align-fill & width ***
@@ -1245,7 +1246,7 @@ void format_test_char(TestFunction check, ExceptionTest check_exception) {
 }
 
 template <class CharT, class TestFunction, class ExceptionTest>
-void format_test_char_as_integer(TestFunction check, ExceptionTest check_exception) {
+TEST_CONSTEXPR_CXX26 void format_test_char_as_integer(TestFunction check, ExceptionTest check_exception) {
   // *** align-fill & width ***
   check(SV("answer is '42'"), SV("answer is '{:<1d}'"), CharT('*'));
 
@@ -3272,4 +3273,15 @@ void format_tests_char_to_wchar_t(TestFunction check) {
 }
 #endif
 
+template <class CharT, class TestFunction, class ExceptionTest>
+TEST_CONSTEXPR_CXX26 void format_tests_constexpr(TestFunction check, ExceptionTest check_exception) {
+  format_string_tests<CharT>(check, check_exception);
+  format_test_bool<CharT>(check, check_exception);
+  format_test_bool_as_integer<CharT>(check, check_exception);
+  format_test_signed_integer<CharT>(check, check_exception);
+  format_test_unsigned_integer<CharT>(check, check_exception);
+  format_test_char<CharT>(check, check_exception);
+  format_test_char_as_integer<CharT>(check, check_exception);
+}
+
 #endif // TEST_STD_UTILITIES_FORMAT_FORMAT_FUNCTIONS_FORMAT_TESTS_H
diff --git a/libcxx/test/std/utilities/format/format.tuple/format.pass.cpp b/libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
index c4fd45f528133e..6b8c82bc2121a4 100644
--- a/libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
@@ -9,6 +9,7 @@
 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=9000000
 
 // <format>
 
@@ -105,6 +106,16 @@ void test() {
   test_assure_parse_is_called<CharT>();
 }
 
+#if TEST_STD_VER >= 26
+constexpr bool test_constexpr() {
+  format_tests_constexpr<char>(test, test_exception);
+#  ifndef TEST_HAS_NO_WIDE_CHARACTERS
+  format_tests_constexpr<wchar_t>(test, test_exception);
+#  endif
+  return true;
+}
+#endif
+
 void test() {
   test<char>();
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
@@ -114,6 +125,9 @@ void test() {
 
 int main(int, char**) {
   test();
+#if TEST_STD_VER >= 26
+  static_assert(test_constexpr());
+#endif
 
   return 0;
 }

>From 224b28c2359625291aeaf5ee9f934e8c5efa45aa Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Tue, 13 Oct 2026 18:40:58 +0200
Subject: [PATCH 30/46] fix: constexpr in formatter_bool.h

---
 libcxx/include/__format/formatter_bool.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/include/__format/formatter_bool.h b/libcxx/include/__format/formatter_bool.h
index febc119d849e0b..5e9f64e4911bf6 100644
--- a/libcxx/include/__format/formatter_bool.h
+++ b/libcxx/include/__format/formatter_bool.h
@@ -24,11 +24,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 #if _LIBCPP_STD_VER >= 20
 
 template <__fmt_char_type _CharT, class _ParseContext>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+_LIBCPP_HIDE_FROM_ABI constexpr
     typename _ParseContext::iterator __formatter_bool_parse(__format_spec::__parser_data<_CharT>&, _ParseContext&);
 
 template <__fmt_char_type _CharT, class _FormatContext>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator
+_LIBCPP_HIDE_FROM_ABI constexpr typename _FormatContext::iterator
 __formatter_bool_format(bool __value, __format_spec::__parser_data<_CharT>, _FormatContext&);
 
 template <__fmt_char_type _CharT>

>From 88407f1a80c06bb7d6f473d9a8d5b5ae85651f86 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Wed, 14 Oct 2026 10:20:11 +0200
Subject: [PATCH 31/46] Update libcxx/include/__format/format_functions.h

Co-authored-by: Hristo Hristov <zingam at outlook.com>
---
 libcxx/include/__format/format_functions.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index 7dec2633ae6451..bf0ef2f18be1df 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -505,7 +505,6 @@ template <class = void>
 [[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string
 vformat(string_view __fmt, format_args __args) {
   // P3391R2: We don't need constant folding runtime optimizations in the scope of a constant evaluation.
-  // `if !consteval` is only present since C++23, so we use !__libcpp_is_constant_evaluated().
   if (!__libcpp_is_constant_evaluated()) {
     auto __result = __format::__try_constant_folding(__fmt, __args);
     if (__result.has_value())

>From c174580ec97152fd8f21c605a4e6216ed913aa89 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Wed, 14 Oct 2026 12:37:38 +0200
Subject: [PATCH 32/46] few fixes for the currently failing tests except for
 the bug_81590

---
 libcxx/include/__format/formatter_bool.h      |  4 ++--
 libcxx/include/__format/formatter_output.h    |  8 +++----
 libcxx/include/__format/formatter_string.h    |  4 +++-
 .../format/format.functions/format.pass.cpp   | 24 +++++++++++++++----
 .../format/format.functions/format_tests.h    |  2 +-
 .../format/format.tuple/format.pass.cpp       | 15 ------------
 6 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/libcxx/include/__format/formatter_bool.h b/libcxx/include/__format/formatter_bool.h
index 5e9f64e4911bf6..3015470a606f81 100644
--- a/libcxx/include/__format/formatter_bool.h
+++ b/libcxx/include/__format/formatter_bool.h
@@ -34,13 +34,13 @@ __formatter_bool_format(bool __value, __format_spec::__parser_data<_CharT>, _For
 template <__fmt_char_type _CharT>
 struct formatter<bool, _CharT> {
   template <class _ParseContext>
-  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _ParseContext::iterator 
+  _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator 
   parse(_ParseContext& __ctx) {
     return std::__formatter_bool_parse(__parser_, __ctx);
   }
 
   template <class _FormatContext>
-  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator 
+  _LIBCPP_HIDE_FROM_ABI constexpr typename _FormatContext::iterator 
   format(bool __value, _FormatContext& __ctx) const {
     return std::__formatter_bool_format(__value, __parser_, __ctx);
   }
diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h
index 68b1fb5d196b06..1926c9eae57b6d 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -99,7 +99,7 @@ __copy(basic_string_view<_CharT> __str, output_iterator<const _OutCharT&> auto _
 template <contiguous_iterator _Iterator,
           __fmt_char_type _CharT    = typename iterator_traits<_Iterator>::value_type,
           __fmt_char_type _OutCharT = _CharT>
-_LIBCPP_HIDE_FROM_ABI auto
+_LIBCPP_HIDE_FROM_ABI constexpr auto
 __copy(_Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it) -> decltype(__out_it) {
   return __formatter::__copy(basic_string_view{__first, __last}, std::move(__out_it));
 }
@@ -119,7 +119,7 @@ template <contiguous_iterator _Iterator,
           __fmt_char_type _CharT    = typename iterator_traits<_Iterator>::value_type,
           __fmt_char_type _OutCharT = _CharT,
           class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI auto
+_LIBCPP_HIDE_FROM_ABI constexpr auto
 __transform(_Iterator __first,
             _Iterator __last,
             output_iterator<const _OutCharT&> auto __out_it,
@@ -251,7 +251,7 @@ template <contiguous_iterator _Iterator,
           class _CharT = typename iterator_traits<_Iterator>::value_type,
           class _ParserCharT,
           class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI auto __write_transformed(
+_LIBCPP_HIDE_FROM_ABI constexpr auto __write_transformed(
     _Iterator __first,
     _Iterator __last,
     output_iterator<const _CharT&> auto __out_it,
@@ -295,7 +295,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __write_string_no_precision(
 }
 
 template <class _CharT>
-_LIBCPP_HIDE_FROM_ABI int __truncate(basic_string_view<_CharT>& __str, int __precision) {
+_LIBCPP_HIDE_FROM_ABI constexpr int __truncate(basic_string_view<_CharT>& __str, int __precision) {
   __format_spec::__column_width_result __result =
       __format_spec::__estimate_column_width(__str, __precision, __format_spec::__column_width_rounding::__down);
   __str = basic_string_view<_CharT>{__str.begin(), __result.__last_};
diff --git a/libcxx/include/__format/formatter_string.h b/libcxx/include/__format/formatter_string.h
index 11aeef252bcaec..c50ce23af13a80 100644
--- a/libcxx/include/__format/formatter_string.h
+++ b/libcxx/include/__format/formatter_string.h
@@ -10,6 +10,7 @@
 #ifndef _LIBCPP___FORMAT_FORMATTER_STRING_H
 #define _LIBCPP___FORMAT_FORMATTER_STRING_H
 
+#include "__configuration/language.h"
 #include <__assert>
 #include <__config>
 #include <__format/fmt_char_type.h>
@@ -65,7 +66,8 @@ struct formatter<const _CharT*, _CharT> : public __formatter_string<_CharT> {
   using _Base _LIBCPP_NODEBUG = __formatter_string<_CharT>;
 
   template <class _FormatContext>
-  _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const _CharT* __str, _FormatContext& __ctx) const {
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator 
+  format(const _CharT* __str, _FormatContext& __ctx) const {
     _LIBCPP_ASSERT_INTERNAL(__str, "The basic_format_arg constructor should have prevented an invalid pointer.");
     // Converting the input to a basic_string_view means the data is looped over twice;
     // - once to determine the length, and
diff --git a/libcxx/test/std/utilities/format/format.functions/format.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format.pass.cpp
index 28ffcd13d9e0ca..bee0a27d29055b 100644
--- a/libcxx/test/std/utilities/format/format.functions/format.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/format.pass.cpp
@@ -8,6 +8,7 @@
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=9000000
 
 // XFAIL: availability-fp_to_chars-missing
 
@@ -39,10 +40,11 @@ auto test =
       std::basic_string<CharT> out = std::format(fmt, std::forward<Args>(args)...);
       if (TEST_IS_CONSTANT_EVALUATED)
         assert(out == expected);
-      TEST_REQUIRE(
-          out == expected,
-          TEST_WRITE_CONCATENATED(
-              "\nFormat string   ", fmt.get(), "\nExpected output ", expected, "\nActual output   ", out, '\n'));
+      else
+        TEST_REQUIRE(
+            out == expected,
+            TEST_WRITE_CONCATENATED(
+                "\nFormat string   ", fmt.get(), "\nExpected output ", expected, "\nActual output   ", out, '\n'));
     };
 
 auto test_exception = []<class CharT, class... Args>(std::string_view, std::basic_string_view<CharT>, Args&&...) {
@@ -52,6 +54,16 @@ auto test_exception = []<class CharT, class... Args>(std::string_view, std::basi
   // The exceptions are tested by other functions that don't use the basic-format-string as fmt argument.
 };
 
+#if TEST_STD_VER >= 26
+constexpr bool test_constexpr() {
+  format_tests_constexpr<char>(test, test_exception);
+#  ifndef TEST_HAS_NO_WIDE_CHARACTERS
+  format_tests_constexpr<wchar_t>(test, test_exception);
+#  endif
+  return true;
+}
+#endif
+
 int main(int, char**) {
   format_tests<char, execution_modus::full>(test, test_exception);
 
@@ -60,5 +72,9 @@ int main(int, char**) {
   format_tests<wchar_t, execution_modus::full>(test, test_exception);
 #endif
 
+#if TEST_STD_VER >= 26
+  static_assert(test_constexpr());
+#endif
+
   return 0;
 }
diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h
index b0d73bbb5c221c..1f431773df9c08 100644
--- a/libcxx/test/std/utilities/format/format.functions/format_tests.h
+++ b/libcxx/test/std/utilities/format/format.functions/format_tests.h
@@ -29,7 +29,7 @@
 enum class execution_modus { partial, full };
 
 template <class CharT>
-std::vector<std::basic_string_view<CharT>> invalid_types(std::string_view valid) {
+constexpr std::vector<std::basic_string_view<CharT>> invalid_types(std::string_view valid) {
   std::vector<std::basic_string_view<CharT>> result;
 
 #define CASE(T)                                                                                                        \
diff --git a/libcxx/test/std/utilities/format/format.tuple/format.pass.cpp b/libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
index 6b8c82bc2121a4..541727fe73f32f 100644
--- a/libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
@@ -9,7 +9,6 @@
 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
 
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
-// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=9000000
 
 // <format>
 
@@ -106,16 +105,6 @@ void test() {
   test_assure_parse_is_called<CharT>();
 }
 
-#if TEST_STD_VER >= 26
-constexpr bool test_constexpr() {
-  format_tests_constexpr<char>(test, test_exception);
-#  ifndef TEST_HAS_NO_WIDE_CHARACTERS
-  format_tests_constexpr<wchar_t>(test, test_exception);
-#  endif
-  return true;
-}
-#endif
-
 void test() {
   test<char>();
 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
@@ -125,9 +114,5 @@ void test() {
 
 int main(int, char**) {
   test();
-#if TEST_STD_VER >= 26
-  static_assert(test_constexpr());
-#endif
-
   return 0;
 }

>From c88ebc0d85aca45a732ec0f64a34ec5ac134800d Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Wed, 14 Oct 2026 15:08:41 +0200
Subject: [PATCH 33/46] Update libcxx/docs/Status/Cxx26Papers.csv

Co-authored-by: Hristo Hristov <zingam at outlook.com>
---
 libcxx/docs/Status/Cxx26Papers.csv | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/docs/Status/Cxx26Papers.csv b/libcxx/docs/Status/Cxx26Papers.csv
index ef9e5d5c38f823..349d0f51b94168 100644
--- a/libcxx/docs/Status/Cxx26Papers.csv
+++ b/libcxx/docs/Status/Cxx26Papers.csv
@@ -175,7 +175,7 @@
 "`P3887R1 <https://wg21.link/P3887R1>`__","Make ``when_all`` a Ronseal Algorithm","2025-11 (Kona)","","","`#171289 <https://github.com/llvm/llvm-project/issues/171289>`__",""
 "`P3923R0 <https://wg21.link/P3923R0>`__","Additional NB comment resolutions for Kona 2025","2025-11 (Kona)","","","`#171290 <https://github.com/llvm/llvm-project/issues/171290>`__",""
 "`P3371R5 <https://wg21.link/P3371R5>`__","Fix C++26 by making the rank-1, rank-2, rank-k, and rank-2k updates consistent with the BLAS","2025-11 (Kona)","","","`#171291 <https://github.com/llvm/llvm-project/issues/171291>`__",""
-"`P3391R2 <https://wg21.link/P3391R2>`__","``constexpr`` ``std::format``","2025-11 (Kona)","|Complete|","24","`#171292 <https://github.com/llvm/llvm-project/issues/171292>`__",""
+"`P3391R2 <https://wg21.link/P3391R2>`__","``constexpr`` ``std::format``","2025-11 (Kona)","|Partial|","24","`#171292 <https://github.com/llvm/llvm-project/issues/171292>`__","`std::format` and formatters"
 "`P3913R1 <https://wg21.link/P3913R1>`__","Optimize ``for std::optional`` in range adaptors","2025-11 (Kona)","","","`#171294 <https://github.com/llvm/llvm-project/issues/171294>`__",""
 "","","","","","",""
 "`P3726R2 <https://wg21.link/P3726R2>`__","Adjustments to Union Lifetime Rules","2026-03 (Croydon)","","","`#189560 <https://github.com/llvm/llvm-project/issues/189560>`__",""

>From c21e3e0bd66b42436d0c59834184a31d741a42aa Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Wed, 14 Oct 2026 16:44:06 +0200
Subject: [PATCH 34/46] update: format_to.pass.cpp

---
 libcxx/include/__format/buffer.h                  |  8 ++++----
 .../format/format.functions/format_to.pass.cpp    | 15 +++++++++++++++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/libcxx/include/__format/buffer.h b/libcxx/include/__format/buffer.h
index a76769601183db..cf40c66a5f5f60 100644
--- a/libcxx/include/__format/buffer.h
+++ b/libcxx/include/__format/buffer.h
@@ -431,7 +431,7 @@ class __direct_iterator_buffer : public __output_buffer<_CharT> {
       : __output_buffer<_CharT>{std::__unwrap_iter(__out_it), __buffer_size, __prepare_write, __max_output_size},
         __out_it_(__out_it) {}
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _OutIt __out_it() && { return __out_it_ + this->__size(); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _OutIt __out_it() && { return __out_it_ + this->__size(); }
 
 private:
   // The function format_to expects a buffer large enough for the output. The
@@ -461,7 +461,7 @@ class __container_inserter_buffer : public __output_buffer<_CharT> {
       : __output_buffer<_CharT>{__small_buffer_, __buffer_size, __prepare_write, __max_output_size},
         __container_{__out_it.__get_container()} {}
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto __out_it() && {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto __out_it() && {
     __container_->insert(__container_->end(), __small_buffer_, __small_buffer_ + this->__size());
     return std::back_inserter(*__container_);
   }
@@ -494,13 +494,13 @@ class __container_inserter_buffer : public __output_buffer<_CharT> {
 template <class _OutIt, __fmt_char_type _CharT>
 class __iterator_buffer : public __allocating_buffer<_CharT> {
 public:
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit __iterator_buffer(_OutIt __out_it)
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator_buffer(_OutIt __out_it)
       : __allocating_buffer<_CharT>{}, __out_it_{std::move(__out_it)} {}
 
   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit __iterator_buffer(_OutIt __out_it, __max_output_size* __max_output_size)
       : __allocating_buffer<_CharT>{__max_output_size}, __out_it_{std::move(__out_it)} {}
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto __out_it() && {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto __out_it() && {
     return std::ranges::copy(this->__view(), std::move(__out_it_)).out;
   }
 
diff --git a/libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp
index 31509e376d94a1..f954445a1a9c32 100644
--- a/libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp
@@ -8,6 +8,7 @@
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=200000000
 
 // XFAIL: availability-fp_to_chars-missing
 
@@ -67,6 +68,16 @@ auto test_exception = []<class CharT, class... Args>(std::string_view, std::basi
   // The exceptions are tested by other functions that don't use the basic-format-string as fmt argument.
 };
 
+#if TEST_STD_VER >= 26
+constexpr bool test_constexpr() {
+  format_tests_constexpr<char>(test, test_exception);
+#  ifndef TEST_HAS_NO_WIDE_CHARACTERS
+  format_tests_constexpr<wchar_t>(test, test_exception);
+#  endif
+  return true;
+}
+#endif
+
 int main(int, char**) {
   format_tests<char, execution_modus::partial>(test, test_exception);
 
@@ -75,5 +86,9 @@ int main(int, char**) {
   format_tests<wchar_t, execution_modus::partial>(test, test_exception);
 #endif
 
+#if TEST_STD_VER >= 26
+  static_assert(test_constexpr());
+#endif
+
   return 0;
 }

>From 27ce12b557129e5e5a7b594e0d9cdf7b761a11f8 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Wed, 14 Oct 2026 16:58:07 +0200
Subject: [PATCH 35/46] update: format_to_n.pass.cpp

---
 libcxx/include/__format/buffer.h              | 19 ++++++++++---------
 .../format.functions/format_to_n.pass.cpp     | 15 +++++++++++++++
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/libcxx/include/__format/buffer.h b/libcxx/include/__format/buffer.h
index cf40c66a5f5f60..f925ebbfe8ad48 100644
--- a/libcxx/include/__format/buffer.h
+++ b/libcxx/include/__format/buffer.h
@@ -57,19 +57,20 @@ namespace __format {
 // A helper to limit the total size of code units written.
 class _LIBCPP_HIDE_FROM_ABI __max_output_size {
 public:
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit __max_output_size(size_t __max_size) : __max_size_{__max_size} {}
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr explicit __max_output_size(size_t __max_size) : __max_size_{__max_size} {}
 
   // This function adjusts the size of a (bulk) write operations. It ensures the
   // number of code units written by a __output_buffer never exceeds
   // __max_size_ code units.
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_t __write_request(size_t __code_units) {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t __write_request(size_t __code_units) {
     size_t __result =
         __code_units_written_ < __max_size_ ? std::min(__code_units, __max_size_ - __code_units_written_) : 0;
     __code_units_written_ += __code_units;
     return __result;
   }
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_t __code_units_written() const noexcept { return __code_units_written_; }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t 
+  __code_units_written() const noexcept { return __code_units_written_; }
 
 private:
   size_t __max_size_;
@@ -528,13 +529,13 @@ class __format_to_n_buffer : private __buffer_selector<_OutIt, _CharT>::type {
 public:
   using _Base _LIBCPP_NODEBUG = __buffer_selector<_OutIt, _CharT>::type;
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI __format_to_n_buffer(_OutIt __out_it, iter_difference_t<_OutIt> __n)
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __format_to_n_buffer(_OutIt __out_it, iter_difference_t<_OutIt> __n)
       : _Base{std::move(__out_it), std::addressof(__max_output_size_)},
         __max_output_size_{__n < 0 ? size_t{0} : static_cast<size_t>(__n)} {}
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return _Base::__make_output_iterator(); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto __make_output_iterator() { return _Base::__make_output_iterator(); }
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __result() && {
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr format_to_n_result<_OutIt> __result() && {
     return {static_cast<_Base&&>(*this).__out_it(),
             static_cast<iter_difference_t<_OutIt>>(__max_output_size_.__code_units_written())};
   }
@@ -552,14 +553,14 @@ class __formatted_size_buffer : private __output_buffer<_CharT> {
 public:
   using _Base _LIBCPP_NODEBUG = __output_buffer<_CharT>;
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI __formatted_size_buffer()
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __formatted_size_buffer()
       : _Base{nullptr, 0, __prepare_write, std::addressof(__max_output_size_)} {}
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI auto __make_output_iterator() { return _Base::__make_output_iterator(); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto __make_output_iterator() { return _Base::__make_output_iterator(); }
 
   // This function does not need to be r-value qualified, however this is
   // consistent with similar objects.
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI size_t __result() && { return __max_output_size_.__code_units_written(); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t __result() && { return __max_output_size_.__code_units_written(); }
 
 private:
   __max_output_size __max_output_size_{0};
diff --git a/libcxx/test/std/utilities/format/format.functions/format_to_n.pass.cpp b/libcxx/test/std/utilities/format/format.functions/format_to_n.pass.cpp
index 149e3413967ba4..a0fd2b7e6d83c9 100644
--- a/libcxx/test/std/utilities/format/format.functions/format_to_n.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/format_to_n.pass.cpp
@@ -8,6 +8,7 @@
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=200000000
 
 // XFAIL: availability-fp_to_chars-missing
 
@@ -101,6 +102,16 @@ auto test_exception = []<class CharT, class... Args>(std::string_view, std::basi
   // The exceptions are tested by other functions that don't use the basic-format-string as fmt argument.
 };
 
+#if TEST_STD_VER >= 26
+constexpr bool test_constexpr() {
+  format_tests_constexpr<char>(test, test_exception);
+#  ifndef TEST_HAS_NO_WIDE_CHARACTERS
+  format_tests_constexpr<wchar_t>(test, test_exception);
+#  endif
+  return true;
+}
+#endif
+
 int main(int, char**) {
   format_tests<char, execution_modus::partial>(test, test_exception);
 
@@ -109,5 +120,9 @@ int main(int, char**) {
   format_tests<wchar_t, execution_modus::partial>(test, test_exception);
 #endif
 
+#if TEST_STD_VER >= 26
+  static_assert(test_constexpr());
+#endif
+
   return 0;
 }

>From da36aa446184438af73c022d2d6464881b08cd93 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Wed, 14 Oct 2026 17:04:12 +0200
Subject: [PATCH 36/46] update: formatted_size.pass.cpp

---
 .../format.functions/formatted_size.pass.cpp      | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp b/libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp
index 472ac447b4ce9b..c07bdf0a630773 100644
--- a/libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp
@@ -8,6 +8,7 @@
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=200000000
 
 // XFAIL: availability-fp_to_chars-missing
 
@@ -41,6 +42,16 @@ auto test_exception = []<class CharT, class... Args>(std::string_view, std::basi
   // The exceptions are tested by other functions that don't use the basic-format-string as fmt argument.
 };
 
+#if TEST_STD_VER >= 26
+constexpr bool test_constexpr() {
+  format_tests_constexpr<char>(test, test_exception);
+#  ifndef TEST_HAS_NO_WIDE_CHARACTERS
+  format_tests_constexpr<wchar_t>(test, test_exception);
+#  endif
+  return true;
+}
+#endif
+
 int main(int, char**) {
   format_tests<char, execution_modus::partial>(test, test_exception);
 
@@ -49,5 +60,9 @@ int main(int, char**) {
   format_tests<wchar_t, execution_modus::partial>(test, test_exception);
 #endif
 
+#if TEST_STD_VER >= 26
+  static_assert(test_constexpr());
+#endif
+
   return 0;
 }

>From 1af942c9bca5087cd674177ed96ee48f0787fd2c Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Wed, 14 Oct 2026 17:10:42 +0200
Subject: [PATCH 37/46] update: vformat.pass.cpp

---
 .../format/format.functions/vformat.pass.cpp  | 31 +++++++++++++------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp
index 99a1bd1f8f2059..ee807618fae457 100644
--- a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp
@@ -8,6 +8,7 @@
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=200000000
 
 // XFAIL: availability-fp_to_chars-missing
 
@@ -39,17 +40,29 @@ auto test_exception =
         [[maybe_unused]] std::string_view what,
         [[maybe_unused]] std::basic_string_view<CharT> fmt,
         [[maybe_unused]] Args&&... args) {
-      TEST_VALIDATE_EXCEPTION(
-          std::format_error,
-          [&]([[maybe_unused]] const std::format_error& e) {
-            TEST_LIBCPP_REQUIRE(
-                e.what() == what,
-                TEST_WRITE_CONCATENATED(
-                    "\nFormat string   ", fmt, "\nExpected exception ", what, "\nActual exception   ", e.what(), '\n'));
-          },
-          TEST_IGNORE_NODISCARD std::vformat(fmt, std::make_format_args<context_t<CharT>>(args...)));
+      if (!TEST_IS_CONSTANT_EVALUATED) {
+        TEST_VALIDATE_EXCEPTION(
+            std::format_error,
+            [&]([[maybe_unused]] const std::format_error& e) {
+              TEST_LIBCPP_REQUIRE(
+                  e.what() == what,
+                  TEST_WRITE_CONCATENATED(
+                      "\nFormat string   ", fmt, "\nExpected exception ", what, "\nActual exception   ", e.what(), '\n'));
+            },
+            TEST_IGNORE_NODISCARD std::vformat(fmt, std::make_format_args<context_t<CharT>>(args...)));
+      }
     };
 
+#if TEST_STD_VER >= 26
+constexpr bool test_constexpr() {
+  format_tests_constexpr<char>(test, test_exception);
+#  ifndef TEST_HAS_NO_WIDE_CHARACTERS
+  format_tests_constexpr<wchar_t>(test, test_exception);
+#  endif
+  return true;
+}
+#endif
+
 int main(int, char**) {
 #if !defined(TEST_HAS_NO_EXCEPTIONS)
   // reproducer of https://llvm.org/PR65011

>From 04586fa4cb5d6cd1783076650551e4ee24b7f362 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Wed, 14 Oct 2026 17:16:45 +0200
Subject: [PATCH 38/46] fix: vformat.pass.cpp

---
 .../std/utilities/format/format.functions/vformat.pass.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp
index ee807618fae457..bd5726f8ca9b01 100644
--- a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp
@@ -30,6 +30,9 @@
 auto test = []<class CharT, class... Args>(
                 std::basic_string_view<CharT> expected, std::basic_string_view<CharT> fmt, Args&&... args) constexpr {
   std::basic_string<CharT> out = std::vformat(fmt, std::make_format_args<context_t<CharT>>(args...));
+  if (TEST_IS_CONSTANT_EVALUATED)
+    assert(out == expected);
+  else
   TEST_REQUIRE(out == expected,
                TEST_WRITE_CONCATENATED(
                    "\nFormat string   ", fmt, "\nExpected output ", expected, "\nActual output   ", out, '\n'));
@@ -82,5 +85,9 @@ int main(int, char**) {
   format_tests<wchar_t, execution_modus::full>(test, test_exception);
 #endif
 
+#if TEST_STD_VER >= 26
+  static_assert(test_constexpr());
+#endif
+
   return 0;
 }

>From d359f82077695a57aa165807b25a9133f04b2f9a Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Wed, 14 Oct 2026 17:20:01 +0200
Subject: [PATCH 39/46] update: vformat_to.pass.cpp

---
 .../format.functions/vformat_to.pass.cpp      | 41 +++++++++++++------
 1 file changed, 29 insertions(+), 12 deletions(-)

diff --git a/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp
index 0047db74cca1db..a7388ad385df78 100644
--- a/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp
@@ -8,6 +8,7 @@
 
 // UNSUPPORTED: c++03, c++11, c++14, c++17
 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=200000000
 
 // XFAIL: availability-fp_to_chars-missing
 
@@ -63,20 +64,32 @@ auto test_exception =
         [[maybe_unused]] std::string_view what,
         [[maybe_unused]] std::basic_string_view<CharT> fmt,
         [[maybe_unused]] Args&&... args) {
-      TEST_VALIDATE_EXCEPTION(
-          std::format_error,
-          [&]([[maybe_unused]] const std::format_error& e) {
-            TEST_LIBCPP_REQUIRE(
-                e.what() == what,
-                TEST_WRITE_CONCATENATED(
-                    "\nFormat string   ", fmt, "\nExpected exception ", what, "\nActual exception   ", e.what(), '\n'));
-          },
-          [&] {
-            std::basic_string<CharT> out;
-            std::vformat_to(std::back_inserter(out), fmt, std::make_format_args<context_t<CharT>>(args...));
-          }());
+      if (!TEST_IS_CONSTANT_EVALUATED) {
+        TEST_VALIDATE_EXCEPTION(
+            std::format_error,
+            [&]([[maybe_unused]] const std::format_error& e) {
+              TEST_LIBCPP_REQUIRE(
+                  e.what() == what,
+                  TEST_WRITE_CONCATENATED(
+                      "\nFormat string   ", fmt, "\nExpected exception ", what, "\nActual exception   ", e.what(), '\n'));
+            },
+            [&] {
+              std::basic_string<CharT> out;
+              std::vformat_to(std::back_inserter(out), fmt, std::make_format_args<context_t<CharT>>(args...));
+            }());
+      }
     };
 
+#if TEST_STD_VER >= 26
+constexpr bool test_constexpr() {
+  format_tests_constexpr<char>(test, test_exception);
+#  ifndef TEST_HAS_NO_WIDE_CHARACTERS
+  format_tests_constexpr<wchar_t>(test, test_exception);
+#  endif
+  return true;
+}
+#endif
+
 int main(int, char**) {
   format_tests<char, execution_modus::partial>(test, test_exception);
 
@@ -85,5 +98,9 @@ int main(int, char**) {
   format_tests<wchar_t, execution_modus::partial>(test, test_exception);
 #endif
 
+#if TEST_STD_VER >= 26
+  static_assert(test_constexpr());
+#endif
+
   return 0;
 }

>From 29ce438f17326556f7d3541d6a28dbc5a77d8a0f Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Wed, 14 Oct 2026 17:40:10 +0200
Subject: [PATCH 40/46] add: 2 check cases for format_tests.h

---
 .../std/utilities/format/format.functions/format_tests.h   | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h
index 1f431773df9c08..aaa9de769e068d 100644
--- a/libcxx/test/std/utilities/format/format.functions/format_tests.h
+++ b/libcxx/test/std/utilities/format/format.functions/format_tests.h
@@ -3282,6 +3282,13 @@ TEST_CONSTEXPR_CXX26 void format_tests_constexpr(TestFunction check, ExceptionTe
   format_test_unsigned_integer<CharT>(check, check_exception);
   format_test_char<CharT>(check, check_exception);
   format_test_char_as_integer<CharT>(check, check_exception);
+
+  // *** Storing a non-constexpr-formattable argument is constexpr. ***
+  check(SV("42"), SV("{}"), 42, 3.0);
+  check(SV("42"), SV("{}"), 42, nullptr);
+
+  // *** No arguments. ***
+  check(SV("hello"), SV("hello"));
 }
 
 #endif // TEST_STD_UTILITIES_FORMAT_FORMAT_FUNCTIONS_FORMAT_TESTS_H

>From e9ec0a404940abcd4de46e7dffc9040f07b11bfe Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Wed, 14 Oct 2026 18:07:53 +0200
Subject: [PATCH 41/46] remove: unnecessary comment

---
 libcxx/include/__format/format_functions.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h
index bf0ef2f18be1df..a3d8cfe151059a 100644
--- a/libcxx/include/__format/format_functions.h
+++ b/libcxx/include/__format/format_functions.h
@@ -522,7 +522,6 @@ template <class = void>
 [[nodiscard]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring
 vformat(wstring_view __fmt, wformat_args __args) {
   // P3391R2: We don't need constant folding runtime optimizations in the scope of a constant evaluation.
-  // `if !consteval` is only present since C++23, so we use !__libcpp_is_constant_evaluated().
   if (!__libcpp_is_constant_evaluated()) {
     auto __result = __format::__try_constant_folding(__fmt, __args);
     if (__result.has_value())

>From cf87e5c3c9dddab11876c338cdb60ab335217850 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Wed, 14 Oct 2026 18:14:36 +0200
Subject: [PATCH 42/46] clang-format run

---
 libcxx/include/__format/buffer.h              | 20 +++++++---
 libcxx/include/__format/format_arg.h          |  4 +-
 libcxx/include/__format/formatter_bool.h      |  6 +--
 libcxx/include/__format/formatter_char.h      |  2 +-
 libcxx/include/__format/formatter_output.h    | 11 +++---
 libcxx/include/__format/formatter_string.h    |  2 +-
 .../format/format.functions/format_tests.h    |  5 +--
 .../format/format.functions/vformat.pass.cpp  | 38 +++++++++----------
 .../format.functions/vformat_to.pass.cpp      | 38 +++++++++----------
 9 files changed, 62 insertions(+), 64 deletions(-)

diff --git a/libcxx/include/__format/buffer.h b/libcxx/include/__format/buffer.h
index f925ebbfe8ad48..52468cc83cf29e 100644
--- a/libcxx/include/__format/buffer.h
+++ b/libcxx/include/__format/buffer.h
@@ -57,7 +57,8 @@ namespace __format {
 // A helper to limit the total size of code units written.
 class _LIBCPP_HIDE_FROM_ABI __max_output_size {
 public:
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr explicit __max_output_size(size_t __max_size) : __max_size_{__max_size} {}
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr explicit __max_output_size(size_t __max_size)
+      : __max_size_{__max_size} {}
 
   // This function adjusts the size of a (bulk) write operations. It ensures the
   // number of code units written by a __output_buffer never exceeds
@@ -69,8 +70,9 @@ class _LIBCPP_HIDE_FROM_ABI __max_output_size {
     return __result;
   }
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t 
-  __code_units_written() const noexcept { return __code_units_written_; }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t __code_units_written() const noexcept {
+    return __code_units_written_;
+  }
 
 private:
   size_t __max_size_;
@@ -533,7 +535,9 @@ class __format_to_n_buffer : private __buffer_selector<_OutIt, _CharT>::type {
       : _Base{std::move(__out_it), std::addressof(__max_output_size_)},
         __max_output_size_{__n < 0 ? size_t{0} : static_cast<size_t>(__n)} {}
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto __make_output_iterator() { return _Base::__make_output_iterator(); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto __make_output_iterator() {
+    return _Base::__make_output_iterator();
+  }
 
   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr format_to_n_result<_OutIt> __result() && {
     return {static_cast<_Base&&>(*this).__out_it(),
@@ -556,11 +560,15 @@ class __formatted_size_buffer : private __output_buffer<_CharT> {
   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __formatted_size_buffer()
       : _Base{nullptr, 0, __prepare_write, std::addressof(__max_output_size_)} {}
 
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto __make_output_iterator() { return _Base::__make_output_iterator(); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto __make_output_iterator() {
+    return _Base::__make_output_iterator();
+  }
 
   // This function does not need to be r-value qualified, however this is
   // consistent with similar objects.
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t __result() && { return __max_output_size_.__code_units_written(); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr size_t __result() && {
+    return __max_output_size_.__code_units_written();
+  }
 
 private:
   __max_output_size __max_output_size_{0};
diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h
index ca39d9cbba4e27..7b6e88491d4cf6 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -355,8 +355,8 @@ class _LIBCPP_NO_SPECIALIZATIONS basic_format_arg {
   __basic_format_arg_value<_Context> __value_;
   __format::__arg_t __type_;
 
-  _LIBCPP_HIDE_FROM_ABI constexpr explicit
-  basic_format_arg(__format::__arg_t __type, __basic_format_arg_value<_Context> __value) noexcept
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_format_arg(
+      __format::__arg_t __type, __basic_format_arg_value<_Context> __value) noexcept
       : __value_(__value), __type_(__type) {}
 };
 
diff --git a/libcxx/include/__format/formatter_bool.h b/libcxx/include/__format/formatter_bool.h
index 3015470a606f81..aee0a665a27a42 100644
--- a/libcxx/include/__format/formatter_bool.h
+++ b/libcxx/include/__format/formatter_bool.h
@@ -34,14 +34,12 @@ __formatter_bool_format(bool __value, __format_spec::__parser_data<_CharT>, _For
 template <__fmt_char_type _CharT>
 struct formatter<bool, _CharT> {
   template <class _ParseContext>
-  _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator 
-  parse(_ParseContext& __ctx) {
+  _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) {
     return std::__formatter_bool_parse(__parser_, __ctx);
   }
 
   template <class _FormatContext>
-  _LIBCPP_HIDE_FROM_ABI constexpr typename _FormatContext::iterator 
-  format(bool __value, _FormatContext& __ctx) const {
+  _LIBCPP_HIDE_FROM_ABI constexpr typename _FormatContext::iterator format(bool __value, _FormatContext& __ctx) const {
     return std::__formatter_bool_format(__value, __parser_, __ctx);
   }
 
diff --git a/libcxx/include/__format/formatter_char.h b/libcxx/include/__format/formatter_char.h
index 137f70d4501ba3..cca9a3bbc50464 100644
--- a/libcxx/include/__format/formatter_char.h
+++ b/libcxx/include/__format/formatter_char.h
@@ -41,7 +41,7 @@ struct __formatter_char {
   }
 
   template <class _FormatContext>
-  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator 
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator
   format(_CharT __value, _FormatContext& __ctx) const {
     if (__parser_.__type_ == __format_spec::__type::__default || __parser_.__type_ == __format_spec::__type::__char)
       return __formatter::__format_char(__value, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx));
diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h
index 1926c9eae57b6d..6cc26a3ded16d5 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -119,11 +119,9 @@ template <contiguous_iterator _Iterator,
           __fmt_char_type _CharT    = typename iterator_traits<_Iterator>::value_type,
           __fmt_char_type _OutCharT = _CharT,
           class _UnaryOperation>
-_LIBCPP_HIDE_FROM_ABI constexpr auto
-__transform(_Iterator __first,
-            _Iterator __last,
-            output_iterator<const _OutCharT&> auto __out_it,
-            _UnaryOperation __operation) -> decltype(__out_it) {
+_LIBCPP_HIDE_FROM_ABI constexpr auto __transform(
+    _Iterator __first, _Iterator __last, output_iterator<const _OutCharT&> auto __out_it, _UnaryOperation __operation)
+    -> decltype(__out_it) {
   if constexpr (std::same_as<decltype(__out_it), std::back_insert_iterator<__format::__output_buffer<_OutCharT>>>) {
     __out_it.__get_container()->__transform(__first, __last, std::move(__operation));
     return __out_it;
@@ -152,7 +150,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr _OutIt __fill(_OutIt __out_it, size_t __n, _Char
 }
 
 template <__fmt_char_type _CharT, output_iterator<const _CharT&> _OutIt>
-_LIBCPP_HIDE_FROM_ABI constexpr _OutIt __fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
+_LIBCPP_HIDE_FROM_ABI constexpr _OutIt
+__fill(_OutIt __out_it, size_t __n, __format_spec::__code_point<_CharT> __value) {
 #  if _LIBCPP_HAS_UNICODE
   if constexpr (same_as<_CharT, char>) {
     std::size_t __bytes = std::countl_one(static_cast<unsigned char>(__value.__data[0]));
diff --git a/libcxx/include/__format/formatter_string.h b/libcxx/include/__format/formatter_string.h
index c50ce23af13a80..ad2c64f55e700f 100644
--- a/libcxx/include/__format/formatter_string.h
+++ b/libcxx/include/__format/formatter_string.h
@@ -66,7 +66,7 @@ struct formatter<const _CharT*, _CharT> : public __formatter_string<_CharT> {
   using _Base _LIBCPP_NODEBUG = __formatter_string<_CharT>;
 
   template <class _FormatContext>
-  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator 
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _FormatContext::iterator
   format(const _CharT* __str, _FormatContext& __ctx) const {
     _LIBCPP_ASSERT_INTERNAL(__str, "The basic_format_arg constructor should have prevented an invalid pointer.");
     // Converting the input to a basic_string_view means the data is looped over twice;
diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h
index aaa9de769e068d..8b8f181d683495 100644
--- a/libcxx/test/std/utilities/format/format.functions/format_tests.h
+++ b/libcxx/test/std/utilities/format/format.functions/format_tests.h
@@ -472,9 +472,8 @@ void format_test_buffer_full(TestFunction check) {
 // Using a const ref for world and universe so a string literal will be a character array.
 // When passed as character array W and U have different types.
 template <class CharT, class W, class U, class TestFunction, class ExceptionTest>
-TEST_CONSTEXPR_CXX26 void 
+TEST_CONSTEXPR_CXX26 void
 format_test_string(const W& world, const U& universe, TestFunction check, ExceptionTest check_exception) {
-
   // *** Valid input tests ***
   // Unused argument is ignored. TODO FMT what does the Standard mandate?
   check(SV("hello world"), SV("hello {}"), world, universe);
@@ -713,7 +712,6 @@ TEST_CONSTEXPR_CXX26 void format_string_tests(TestFunction check, ExceptionTest
 
 template <class CharT, class TestFunction, class ExceptionTest>
 TEST_CONSTEXPR_CXX26 void format_test_bool(TestFunction check, ExceptionTest check_exception) {
-
   // *** align-fill & width ***
   check(SV("answer is 'true   '"), SV("answer is '{:7}'"), true);
   check(SV("answer is '   true'"), SV("answer is '{:>7}'"), true);
@@ -1178,7 +1176,6 @@ TEST_CONSTEXPR_CXX26 void format_test_unsigned_integer(TestFunction check, Excep
 
 template <class CharT, class TestFunction, class ExceptionTest>
 TEST_CONSTEXPR_CXX26 void format_test_char(TestFunction check, ExceptionTest check_exception) {
-
   // ***** Char type *****
   // *** align-fill & width ***
   check(SV("answer is '*     '"), SV("answer is '{:6}'"), CharT('*'));
diff --git a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp
index bd5726f8ca9b01..de4caef9e92ea0 100644
--- a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp
@@ -33,28 +33,26 @@ auto test = []<class CharT, class... Args>(
   if (TEST_IS_CONSTANT_EVALUATED)
     assert(out == expected);
   else
-  TEST_REQUIRE(out == expected,
-               TEST_WRITE_CONCATENATED(
-                   "\nFormat string   ", fmt, "\nExpected output ", expected, "\nActual output   ", out, '\n'));
+    TEST_REQUIRE(out == expected,
+                 TEST_WRITE_CONCATENATED(
+                     "\nFormat string   ", fmt, "\nExpected output ", expected, "\nActual output   ", out, '\n'));
 };
 
-auto test_exception =
-    []<class CharT, class... Args>(
-        [[maybe_unused]] std::string_view what,
-        [[maybe_unused]] std::basic_string_view<CharT> fmt,
-        [[maybe_unused]] Args&&... args) {
-      if (!TEST_IS_CONSTANT_EVALUATED) {
-        TEST_VALIDATE_EXCEPTION(
-            std::format_error,
-            [&]([[maybe_unused]] const std::format_error& e) {
-              TEST_LIBCPP_REQUIRE(
-                  e.what() == what,
-                  TEST_WRITE_CONCATENATED(
-                      "\nFormat string   ", fmt, "\nExpected exception ", what, "\nActual exception   ", e.what(), '\n'));
-            },
-            TEST_IGNORE_NODISCARD std::vformat(fmt, std::make_format_args<context_t<CharT>>(args...)));
-      }
-    };
+auto test_exception = []<class CharT, class... Args>([[maybe_unused]] std::string_view what,
+                                                     [[maybe_unused]] std::basic_string_view<CharT> fmt,
+                                                     [[maybe_unused]] Args&&... args) {
+  if (!TEST_IS_CONSTANT_EVALUATED) {
+    TEST_VALIDATE_EXCEPTION(
+        std::format_error,
+        [&]([[maybe_unused]] const std::format_error& e) {
+          TEST_LIBCPP_REQUIRE(
+              e.what() == what,
+              TEST_WRITE_CONCATENATED(
+                  "\nFormat string   ", fmt, "\nExpected exception ", what, "\nActual exception   ", e.what(), '\n'));
+        },
+        TEST_IGNORE_NODISCARD std::vformat(fmt, std::make_format_args<context_t<CharT>>(args...)));
+  }
+};
 
 #if TEST_STD_VER >= 26
 constexpr bool test_constexpr() {
diff --git a/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp b/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp
index a7388ad385df78..10320234b1faa1 100644
--- a/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp
@@ -59,26 +59,24 @@ auto test = []<class CharT, class... Args>(
   }
 };
 
-auto test_exception =
-    []<class CharT, class... Args>(
-        [[maybe_unused]] std::string_view what,
-        [[maybe_unused]] std::basic_string_view<CharT> fmt,
-        [[maybe_unused]] Args&&... args) {
-      if (!TEST_IS_CONSTANT_EVALUATED) {
-        TEST_VALIDATE_EXCEPTION(
-            std::format_error,
-            [&]([[maybe_unused]] const std::format_error& e) {
-              TEST_LIBCPP_REQUIRE(
-                  e.what() == what,
-                  TEST_WRITE_CONCATENATED(
-                      "\nFormat string   ", fmt, "\nExpected exception ", what, "\nActual exception   ", e.what(), '\n'));
-            },
-            [&] {
-              std::basic_string<CharT> out;
-              std::vformat_to(std::back_inserter(out), fmt, std::make_format_args<context_t<CharT>>(args...));
-            }());
-      }
-    };
+auto test_exception = []<class CharT, class... Args>([[maybe_unused]] std::string_view what,
+                                                     [[maybe_unused]] std::basic_string_view<CharT> fmt,
+                                                     [[maybe_unused]] Args&&... args) {
+  if (!TEST_IS_CONSTANT_EVALUATED) {
+    TEST_VALIDATE_EXCEPTION(
+        std::format_error,
+        [&]([[maybe_unused]] const std::format_error& e) {
+          TEST_LIBCPP_REQUIRE(
+              e.what() == what,
+              TEST_WRITE_CONCATENATED(
+                  "\nFormat string   ", fmt, "\nExpected exception ", what, "\nActual exception   ", e.what(), '\n'));
+        },
+        [&] {
+          std::basic_string<CharT> out;
+          std::vformat_to(std::back_inserter(out), fmt, std::make_format_args<context_t<CharT>>(args...));
+        }());
+  }
+};
 
 #if TEST_STD_VER >= 26
 constexpr bool test_constexpr() {

>From cd86b8ef449388d66df1938c06de93420add32c8 Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Wed, 14 Oct 2026 18:15:58 +0200
Subject: [PATCH 43/46] revert: unnecessary change

---
 libcxx/test/std/utilities/format/format.tuple/format.pass.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libcxx/test/std/utilities/format/format.tuple/format.pass.cpp b/libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
index 541727fe73f32f..c4fd45f528133e 100644
--- a/libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.tuple/format.pass.cpp
@@ -114,5 +114,6 @@ void test() {
 
 int main(int, char**) {
   test();
+
   return 0;
 }

>From a5810a45ca8e6ffd6c5006ee98bb147c1956b9cb Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Sat, 17 Oct 2026 02:24:32 +0200
Subject: [PATCH 44/46] fix suggestion for bug_81590 test

---
 .../format/format.functions/bug_81590.compile.pass.cpp       | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libcxx/test/std/utilities/format/format.functions/bug_81590.compile.pass.cpp b/libcxx/test/std/utilities/format/format.functions/bug_81590.compile.pass.cpp
index 23dd9fe841b904..11a08cacd410c6 100644
--- a/libcxx/test/std/utilities/format/format.functions/bug_81590.compile.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.functions/bug_81590.compile.pass.cpp
@@ -24,9 +24,12 @@ struct X : std::variant<X*> {
   constexpr const std::variant<X*>& decay() const noexcept { return *this; }
 };
 
+// P3391R2: the argument to storage calls need to be constexpr and they are
+// instantiated eagerly, so a deduced return type makes __formattable_with<X>
+// depend on itself.
 template <>
 struct std::formatter<X, char> : std::formatter<std::string, char> {
-  static constexpr auto format(const X& x, auto& ctx) {
+  static constexpr auto format(const X& x, auto& ctx) -> decltype(ctx.out()) {
     if (!x.p)
       return ctx.out();
     auto m = [&](const X* t) { return std::format_to(ctx.out(), "{}", *t); };

>From ac99a203d8674f796c6311f22ccdc8f19817738a Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Sun, 18 Oct 2026 14:56:51 +0200
Subject: [PATCH 45/46] tentative: fix CI tests

---
 libcxx/include/__chrono/formatter.h  | 2 ++
 libcxx/include/__format/format_arg.h | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/libcxx/include/__chrono/formatter.h b/libcxx/include/__chrono/formatter.h
index 70491a114a6e36..1088359283dedf 100644
--- a/libcxx/include/__chrono/formatter.h
+++ b/libcxx/include/__chrono/formatter.h
@@ -44,12 +44,14 @@
 #  include <__concepts/arithmetic.h>
 #  include <__concepts/same_as.h>
 #  include <__format/fmt_char_type.h>
+#  include <__format/format_context.h>
 #  include <__format/format_error.h>
 #  include <__format/format_functions.h>
 #  include <__format/format_parse_context.h>
 #  include <__format/formatter.h>
 #  include <__format/parser_std_format_spec.h>
 #  include <__format/write_escaped.h>
+#  include <__iterator/back_insert_iterator.h>
 #  include <__iterator/istreambuf_iterator.h>
 #  include <__iterator/ostreambuf_iterator.h>
 #  include <__locale_dir/num.h>
diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h
index 7b6e88491d4cf6..a51ca2a0f2483d 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -214,7 +214,7 @@ class __basic_format_arg_value {
   /// Contains the implementation for basic_format_arg::handle.
   struct __handle {
     template <class _Tp>
-    _LIBCPP_HIDE_FROM_ABI explicit __handle(_Tp& __v) noexcept
+    _LIBCPP_HIDE_FROM_ABI constexpr explicit __handle(_Tp& __v) noexcept
         : __ptr_(std::addressof(__v)),
           __format_([](basic_format_parse_context<_CharT>& __parse_ctx, _Context& __ctx, const void* __ptr) {
             using _Dp = remove_const_t<_Tp>;

>From 38a9107a99d8b98ec9be60e6be2737f2e903f93f Mon Sep 17 00:00:00 2001
From: Lucas Mellone <github.snugness349 at passinbox.com>
Date: Sun, 18 Oct 2026 15:07:56 +0200
Subject: [PATCH 46/46] fix: constexpr explicit ordering

---
 libcxx/include/__format/buffer.h         | 10 +++++-----
 libcxx/include/__format/format_context.h |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libcxx/include/__format/buffer.h b/libcxx/include/__format/buffer.h
index 52468cc83cf29e..c88b43a19f9433 100644
--- a/libcxx/include/__format/buffer.h
+++ b/libcxx/include/__format/buffer.h
@@ -188,7 +188,7 @@ class __output_buffer {
   using __prepare_write_type _LIBCPP_NODEBUG = void (*)(__output_buffer<_CharT>&, size_t);
 
   [[nodiscard]]
-  _LIBCPP_HIDE_FROM_ABI explicit constexpr __output_buffer(
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit __output_buffer(
       _CharT* __ptr, size_t __capacity, __prepare_write_type __function)
       : __output_buffer{__ptr, __capacity, __function, nullptr} {}
 
@@ -425,11 +425,11 @@ class __allocating_buffer : public __output_buffer<_CharT> {
 template <class _OutIt, __fmt_char_type _CharT>
 class __direct_iterator_buffer : public __output_buffer<_CharT> {
 public:
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit constexpr __direct_iterator_buffer(_OutIt __out_it)
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr explicit __direct_iterator_buffer(_OutIt __out_it)
       : __direct_iterator_buffer{__out_it, nullptr} {}
 
   [[nodiscard]]
-  _LIBCPP_HIDE_FROM_ABI explicit constexpr __direct_iterator_buffer(
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit __direct_iterator_buffer(
       _OutIt __out_it, __max_output_size* __max_output_size)
       : __output_buffer<_CharT>{std::__unwrap_iter(__out_it), __buffer_size, __prepare_write, __max_output_size},
         __out_it_(__out_it) {}
@@ -455,11 +455,11 @@ class __direct_iterator_buffer : public __output_buffer<_CharT> {
 template <class _OutIt, __fmt_char_type _CharT>
 class __container_inserter_buffer : public __output_buffer<_CharT> {
 public:
-  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI explicit constexpr __container_inserter_buffer(_OutIt __out_it)
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr explicit __container_inserter_buffer(_OutIt __out_it)
       : __container_inserter_buffer{__out_it, nullptr} {}
 
   [[nodiscard]]
-  _LIBCPP_HIDE_FROM_ABI explicit constexpr __container_inserter_buffer(
+  _LIBCPP_HIDE_FROM_ABI constexpr explicit __container_inserter_buffer(
       _OutIt __out_it, __max_output_size* __max_output_size)
       : __output_buffer<_CharT>{__small_buffer_, __buffer_size, __prepare_write, __max_output_size},
         __container_{__out_it.__get_container()} {}
diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index a849f9e733bb5a..ee602b1a3ec3f5 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -115,7 +115,7 @@ class _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_
       _OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>, optional<std::locale>&&);
 
   // Note: the Standard doesn't specify the required constructors.
-  _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR_SINCE_CXX26
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit
   basic_format_context(_OutIt __out_it, basic_format_args<basic_format_context> __args, optional<std::locale>&& __loc)
       : __out_it_(std::move(__out_it)), __args_(__args), __loc_(std::move(__loc)) {}
 #  else
@@ -123,7 +123,7 @@ class _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_
   friend _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 basic_format_context<_OtherOutIt, _OtherCharT>
       __format_context_create(_OtherOutIt, basic_format_args<basic_format_context<_OtherOutIt, _OtherCharT>>);
 
-  _LIBCPP_HIDE_FROM_ABI explicit _LIBCPP_CONSTEXPR_SINCE_CXX26
+  _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit
   basic_format_context(_OutIt __out_it, basic_format_args<basic_format_context> __args)
       : __out_it_(std::move(__out_it)), __args_(__args) {}
 #  endif



More information about the libcxx-commits mailing list