1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // UNSUPPORTED: c++03, c++11, c++14 10 11 // to_chars requires functions in the dylib that were introduced in Mac OS 10.15. 12 // 13 // XFAIL: use_system_cxx_lib && target={{.+}}-apple-macosx10.{{.+}} 14 15 // steady_clock requires threads. 16 // UNSUPPORTED: libcpp-has-no-threads 17 // UNSUPPORTED: libcpp-has-no-random-device 18 // UNSUPPORTED: libcpp-has-no-localization 19 20 // TODO(ldionne): This test fails on Ubuntu Focal on our CI nodes (and only there), in 32 bit mode. 21 // UNSUPPORTED: linux && 32bits-on-64bits 22 23 // XFAIL: LIBCXX-AIX-FIXME 24 25 // <charconv> 26 27 #include <type_traits> 28 29 // Work-around for sprintf_s's usage in the Microsoft tests. 30 #ifndef _WIN32 31 # define sprintf_s snprintf 32 #endif 33 34 // FUNCTION TEMPLATE _Bit_cast 35 template <class _To, class _From, 36 std::enable_if_t<sizeof(_To) == sizeof(_From) && std::is_trivially_copyable_v<_To> && 37 std::is_trivially_copyable_v<_From>, 38 int> = 0> 39 [[nodiscard]] constexpr _To _Bit_cast(const _From& _From_obj) noexcept { 40 return __builtin_bit_cast(_To, _From_obj); 41 } 42 43 // Includes Microsoft's test that tests the entire header. 44 45 #include "test.cpp" 46