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