[llvm] [ADT] Introduce Casting function objects (PR #165803)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 3 11:46:07 PST 2025


================
@@ -561,6 +562,53 @@ TEST(CastingTest, assertion_check_unique_ptr) {
       << "Invalid cast of const ref did not cause an abort()";
 }
 
+TEST(Casting, StaticCastPredicate) {
+  std::vector<uint32_t> Values{1, 2};
+
+  EXPECT_TRUE(
+      all_of(map_range(Values, StaticCastTo<uint64_t>),
+             [](const auto &V) { return sizeof(V) == sizeof(uint64_t); }));
----------------
kuhar wrote:

This can be tested with `is_same` over the dereferenced begin iterator

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


More information about the llvm-commits mailing list