[libcxx-commits] [PATCH] D154728: [libc++] Add some tests for std::bit_cast using pointers

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 7 10:37:54 PDT 2023


ldionne created this revision.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154728

Files:
  libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp


Index: libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
===================================================================
--- libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
+++ libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
@@ -239,6 +239,28 @@
 #endif
     }
 
+    // Test pointers
+    {
+        {
+            int obj = 3;
+            void* p = &obj;
+            test_roundtrip_through_nested_T(p);
+            test_roundtrip_through_buffer(p);
+            test_roundtrip_through<void*>(p);
+            test_roundtrip_through<char*>(p);
+            test_roundtrip_through<int*>(p);
+        }
+        {
+            int obj = 3;
+            int* p = &obj;
+            test_roundtrip_through_nested_T(p);
+            test_roundtrip_through_buffer(p);
+            test_roundtrip_through<int*>(p);
+            test_roundtrip_through<char*>(p);
+            test_roundtrip_through<void*>(p);
+        }
+    }
+
     return true;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154728.538199.patch
Type: text/x-patch
Size: 975 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230707/db87f35c/attachment.bin>


More information about the libcxx-commits mailing list