brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 9279511 Raw
55 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++1410 11// TODO Investigate why this fails12// UNSUPPORTED: windows13 14// This test times out under msan15// UNSUPPORTED: msan16 17// to_chars requires functions in the dylib that have not been introduced in older18// versions of the dylib on macOS.19// XFAIL: availability-fp_to_chars-missing20 21// steady_clock requires threads.22// UNSUPPORTED: no-threads23// UNSUPPORTED: no-random-device24// UNSUPPORTED: no-localization25 26// XFAIL: LIBCXX-AIX-FIXME27 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 _WIN3235#  define sprintf_s snprintf36#endif37 38#ifdef _MSVC_STL_VERSION39#include <xutility>40using std::_Bit_cast;41#else42// FUNCTION TEMPLATE _Bit_cast43template <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#endif51 52// Includes Microsoft's test that tests the entire header.53 54#include "test.cpp"55