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// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
10
11// test numeric_limits
12
13// has_denorm_loss
14
15#include <limits>
16
17#include "test_macros.h"
18
19template <class T, bool expected>
20void
21test()
22{
23 static_assert(std::numeric_limits<T>::has_denorm_loss == expected, "has_denorm_loss test 1");
24 static_assert(std::numeric_limits<const T>::has_denorm_loss == expected, "has_denorm_loss test 2");
25 static_assert(std::numeric_limits<volatile T>::has_denorm_loss == expected, "has_denorm_loss test 3");
26 static_assert(std::numeric_limits<const volatile T>::has_denorm_loss == expected, "has_denorm_loss test 4");
27}
28
29int main(int, char**)
30{
31 test<bool, false>();
32 test<char, false>();
33 test<signed char, false>();
34 test<unsigned char, false>();
35 test<wchar_t, false>();
36#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
37 test<char8_t, false>();
38#endif
39 test<char16_t, false>();
40 test<char32_t, false>();
41 test<short, false>();
42 test<unsigned short, false>();
43 test<int, false>();
44 test<unsigned int, false>();
45 test<long, false>();
46 test<unsigned long, false>();
47 test<long long, false>();
48 test<unsigned long long, false>();
49#ifndef TEST_HAS_NO_INT128
50 test<__int128_t, false>();
51 test<__uint128_t, false>();
52#endif
53 test<float, false>();
54 test<double, false>();
55 test<long double, false>();
56
57 return 0;
58}
59

source code of libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/has_denorm_loss.pass.cpp