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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 7 14:15:02 PDT 2023


Author: Louis Dionne
Date: 2023-07-07T17:14:52-04:00
New Revision: 1c834112f27adc8b9372e3cb8ebd39e827d3c7cd

URL: https://github.com/llvm/llvm-project/commit/1c834112f27adc8b9372e3cb8ebd39e827d3c7cd
DIFF: https://github.com/llvm/llvm-project/commit/1c834112f27adc8b9372e3cb8ebd39e827d3c7cd.diff

LOG: [libc++] Add some tests for std::bit_cast using pointers

Differential Revision: https://reviews.llvm.org/D154728

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp b/libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
index fe1e3063c5a99f..f73877416a7170 100644
--- a/libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
+++ b/libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp
@@ -239,6 +239,28 @@ bool tests() {
 #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;
 }
 


        


More information about the libcxx-commits mailing list