[libcxx-commits] [libcxx] [libc++] Assert the element and range preconditions of list::splice and forward_list::splice_after (PR #232538)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 3 05:46:34 PST 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions ,cpp -- libcxx/test/libcxx/containers/sequences/forwardlist/assert.splice_after.pass.cpp libcxx/test/libcxx/containers/sequences/list/list.ops/assert.splice.pos_list.pass.cpp libcxx/test/libcxx/containers/sequences/list/list.ops/assert.splice.pos_list_iter.pass.cpp libcxx/test/libcxx/containers/sequences/list/list.ops/assert.splice.pos_list_iter_iter.pass.cpp libcxx/include/forward_list libcxx/include/list libcxx/test/libcxx/containers/sequences/forwardlist/assert.pass.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index b30002743..11175afe8 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -1282,7 +1282,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX26 void forward_list<_Tp, _Alloc>::resize(size_type _
 template <class _Tp, class _Alloc>
 _LIBCPP_CONSTEXPR_SINCE_CXX26 void forward_list<_Tp, _Alloc>::splice_after(const_iterator __p, forward_list& __x) {
   _LIBCPP_ASSERT_VALID_INPUT_RANGE(
-      this != std::addressof(__x), "forward_list::splice_after(iterator, forward_list) called with this == &forward_list");
+      this != std::addressof(__x),
+      "forward_list::splice_after(iterator, forward_list) called with this == &forward_list");
   if (!__x.empty()) {
     if (__p.__ptr_->__next_ != nullptr) {
       const_iterator __lm1 = __x.before_begin();

``````````

</details>


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


More information about the libcxx-commits mailing list