[libcxx-commits] [libcxx] [libc++][hardening] Constrain construction and use `static_assert` for `__{bounded.wrap}_iter` (PR #115271)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Nov 6 22:45:13 PST 2024
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 9b058bb42d49afb61b07a7eeeea1ad3d1407f1c9 9115be18ade8cc1977eb3d04daa398bc3d23043b --extensions h,cpp -- libcxx/test/libcxx/iterators/contiguous_iterators.verify.cpp libcxx/test/libcxx/iterators/wrap.bounded.iter.conv.compile.pass.cpp libcxx/include/__iterator/bounded_iter.h libcxx/include/__iterator/wrap_iter.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/test/libcxx/iterators/wrap.bounded.iter.conv.compile.pass.cpp b/libcxx/test/libcxx/iterators/wrap.bounded.iter.conv.compile.pass.cpp
index 86f33eaef8..6837f527fe 100644
--- a/libcxx/test/libcxx/iterators/wrap.bounded.iter.conv.compile.pass.cpp
+++ b/libcxx/test/libcxx/iterators/wrap.bounded.iter.conv.compile.pass.cpp
@@ -30,14 +30,16 @@ static_assert(!std::is_convertible<std::array<Derived, 1>::const_iterator, std::
"");
static_assert(!std::is_constructible<std::array<Base, 1>::iterator, std::array<Derived, 1>::iterator>::value, "");
static_assert(!std::is_constructible<std::array<Base, 1>::iterator, std::array<Derived, 1>::const_iterator>::value, "");
-static_assert(!std::is_constructible<std::array<Base, 1>::const_iterator, std::array<Derived, 1>::const_iterator>::value, "");
+static_assert(
+ !std::is_constructible<std::array<Base, 1>::const_iterator, std::array<Derived, 1>::const_iterator>::value, "");
static_assert(!std::is_convertible<std::vector<Derived>::iterator, std::vector<Base>::iterator>::value, "");
static_assert(!std::is_convertible<std::vector<Derived>::iterator, std::vector<Base>::const_iterator>::value, "");
static_assert(!std::is_convertible<std::vector<Derived>::const_iterator, std::vector<Base>::const_iterator>::value, "");
static_assert(!std::is_constructible<std::vector<Base>::iterator, std::vector<Derived>::iterator>::value, "");
static_assert(!std::is_constructible<std::vector<Base>::iterator, std::vector<Derived>::const_iterator>::value, "");
-static_assert(!std::is_constructible<std::vector<Base>::const_iterator, std::vector<Derived>::const_iterator>::value, "");
+static_assert(!std::is_constructible<std::vector<Base>::const_iterator, std::vector<Derived>::const_iterator>::value,
+ "");
#if TEST_STD_VER >= 20
static_assert(!std::is_convertible_v<std::span<Derived>::iterator, std::span<Base>::iterator>);
``````````
</details>
https://github.com/llvm/llvm-project/pull/115271
More information about the libcxx-commits
mailing list