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 // TODO Investigate why this fails 12 // UNSUPPORTED: windows 13 14 // This test times out under msan 15 // UNSUPPORTED: msan 16 17 // to_chars requires functions in the dylib that have not been introduced in older 18 // versions of the dylib on macOS. 19 // XFAIL: availability-fp_to_chars-missing 20 21 // steady_clock requires threads. 22 // UNSUPPORTED: no-threads 23 // UNSUPPORTED: no-random-device 24 // UNSUPPORTED: no-localization 25 26 // XFAIL: LIBCXX-AIX-FIXME 27 28 // <charconv> 29 30 #include <type_traits> 31 #include "test_macros.h" 32 33 // Work-around for sprintf_s's usage in the Microsoft tests. 34 #ifndef _WIN32 35 # define sprintf_s snprintf 36 #endif 37 38 #ifdef _MSVC_STL_VERSION 39 #include <xutility> 40 using std::_Bit_cast; 41 #else 42 // FUNCTION TEMPLATE _Bit_cast 43 template <class _To, class _From, 44 std::enable_if_t<sizeof(_To) == sizeof(_From) && std::is_trivially_copyable_v<_To> && 45 std::is_trivially_copyable_v<_From>, 46 int> = 0> 47 [[nodiscard]] constexpr _To _Bit_cast(const _From& _From_obj) noexcept { 48 return __builtin_bit_cast(_To, _From_obj); 49 } 50 #endif 51 52 // Includes Microsoft's test that tests the entire header. 53 54 #include "test.cpp" 55