[libc++] Implement C++20's P0476R2: std::bit_cast
Thanks to Arthur O'Dwyer for fixing up some of the tests.
Differential Revision: https://reviews.llvm.org/D75960
NOKEYCHECK=True
GitOrigin-RevId: b1fb3d75c953fa2e02ebddb6ebbf100f99786f0c
diff --git a/include/bit b/include/bit
index 168cdd9..eab6797 100644
--- a/include/bit
+++ b/include/bit
@@ -14,6 +14,9 @@
bit synopsis
namespace std {
+ // [bit.cast], bit_cast
+ template<class To, class From>
+ constexpr To bit_cast(const From& from) noexcept; // C++20
// [bit.pow.two], integral powers of 2
template <class T>
@@ -54,8 +57,9 @@
*/
-#include <__config>
+#include <__bit/bit_cast.h>
#include <__bits> // __libcpp_clz
+#include <__config>
#include <__debug>
#include <limits>
#include <type_traits>