1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // test numeric_limits
12 // Specializations shall be provided for each arithmetic type, both floating
13 // point and integer, including bool. The member is_specialized shall be
14 // true for all such specializations of numeric_limits.
16 // Non-arithmetic standard types, such as complex<T> (26.3.2), shall not
17 // have specializations.
19 // From [numeric.limits]:
21 // The value of each member of a specialization of numeric_limits on a cv
22 // -qualified type cv T shall be equal to the value of the corresponding
23 // member of the specialization on the unqualified type T.
25 // More convenient to test it here.
33 static_assert(std::numeric_limits<T>::is_specialized,
34 "std::numeric_limits<T>::is_specialized");
35 static_assert(std::numeric_limits<const T>::is_specialized,
36 "std::numeric_limits<const T>::is_specialized");
37 static_assert(std::numeric_limits<volatile T>::is_specialized,
38 "std::numeric_limits<volatile T>::is_specialized");
39 static_assert(std::numeric_limits<const volatile T>::is_specialized,
40 "std::numeric_limits<const volatile T>::is_specialized");
48 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
51 #endif // _LIBCPP_HAS_NO_UNICODE_CHARS
53 test<unsigned char>();
55 test<unsigned short>();
59 test<unsigned long>();
60 test<signed long long>();
61 test<unsigned long long>();
62 #ifndef _LIBCPP_HAS_NO_INT128
69 static_assert(!std::numeric_limits<std::complex<double> >::is_specialized,
70 "!std::numeric_limits<std::complex<double> >::is_specialized");