[libcxx-commits] [libcxx] [libc++] Remove `noexcept` from `format_context::arg` method (PR #205809)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 25 06:06:16 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: David Bayer (davebayer)

<details>
<summary>Changes</summary>

The `format_context` specialization for `__retarget_buffer` has the `arg` method marked as `noexcept`. However, the function pointer that it invokes throws exceptions which can cause in unwanted abortion of the program.

This PR removes the `noexcept` specifier from this method.

---
Full diff: https://github.com/llvm/llvm-project/pull/205809.diff


1 Files Affected:

- (modified) libcxx/include/__format/format_context.h (+1-1) 


``````````diff
diff --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index cf3131b80e52f..a7064ed8c4bab 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -182,7 +182,7 @@ class basic_format_context<typename __format::__retarget_buffer<_CharT>::__itera
         }) {
   }
 
-  _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const noexcept {
+  _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context> arg(size_t __id) const {
     return __arg_(__ctx_, __id);
   }
 #  if _LIBCPP_HAS_LOCALIZATION

``````````

</details>


https://github.com/llvm/llvm-project/pull/205809


More information about the libcxx-commits mailing list