[JITLink][LoongArch] Support R_LARCH_ALIGN relaxation (#122259)
[llvm-project.git] / libcxx / test / std / utilities / utility / utility.intcmp / intcmp.verify.cpp
blob07ea511ae30a73d73ef8367c3860f90bd8ba4b57
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // <utility>
13 // template<class T, class U>
14 // constexpr bool cmp_equal(T t, U u) noexcept; // C++20
16 // template<class T, class U>
17 // constexpr bool cmp_not_equal(T t, U u) noexcept; // C++20
19 // template<class T, class U>
20 // constexpr bool cmp_less(T t, U u) noexcept; // C++20
22 // template<class T, class U>
23 // constexpr bool cmp_less_equal(T t, U u) noexcept; // C++20
25 // template<class T, class U>
26 // constexpr bool cmp_greater(T t, U u) noexcept; // C++20
28 // template<class T, class U>
29 // constexpr bool cmp_greater_equal(T t, U u) noexcept; // C++20
31 // template<class R, class T>
32 // constexpr bool in_range(T t) noexcept; // C++20
34 #include <utility>
35 #include <cstddef>
37 #include "test_macros.h"
39 struct NonEmptyT {
40 int val;
41 NonEmptyT() : val(0) {}
42 NonEmptyT(int val) : val(val) {}
43 operator int&() { return val; }
44 operator int() const { return val; }
47 enum ColorT { red, green, blue };
49 struct EmptyT {};
51 template <class T>
52 constexpr void test() {
53 std::cmp_equal(T(), T()); // expected-error 10-11 {{no matching function for call to 'cmp_equal'}}
54 std::cmp_equal(T(), int()); // expected-error 10-11 {{no matching function for call to 'cmp_equal'}}
55 std::cmp_equal(int(), T()); // expected-error 10-11 {{no matching function for call to 'cmp_equal'}}
56 std::cmp_not_equal(T(), T()); // expected-error 10-11 {{no matching function for call to 'cmp_not_equal'}}
57 std::cmp_not_equal(T(), int()); // expected-error 10-11 {{no matching function for call to 'cmp_not_equal'}}
58 std::cmp_not_equal(int(), T()); // expected-error 10-11 {{no matching function for call to 'cmp_not_equal'}}
59 std::cmp_less(T(), T()); // expected-error 10-11 {{no matching function for call to 'cmp_less'}}
60 std::cmp_less(T(), int()); // expected-error 10-11 {{no matching function for call to 'cmp_less'}}
61 std::cmp_less(int(), T()); // expected-error 10-11 {{no matching function for call to 'cmp_less'}}
62 std::cmp_less_equal(T(), T()); // expected-error 10-11 {{no matching function for call to 'cmp_less_equal'}}
63 std::cmp_less_equal(T(), int()); // expected-error 10-11 {{no matching function for call to 'cmp_less_equal'}}
64 std::cmp_less_equal(int(), T()); // expected-error 10-11 {{no matching function for call to 'cmp_less_equal'}}
65 std::cmp_greater(T(), T()); // expected-error 10-11 {{no matching function for call to 'cmp_greater'}}
66 std::cmp_greater(T(), int()); // expected-error 10-11 {{no matching function for call to 'cmp_greater'}}
67 std::cmp_greater(int(), T()); // expected-error 10-11 {{no matching function for call to 'cmp_greater'}}
68 std::cmp_greater_equal(T(), T()); // expected-error 10-11 {{no matching function for call to 'cmp_greater_equal'}}
69 std::cmp_greater_equal(T(), int()); // expected-error 10-11 {{no matching function for call to 'cmp_greater_equal'}}
70 std::cmp_greater_equal(int(), T()); // expected-error 10-11 {{no matching function for call to 'cmp_greater_equal'}}
71 std::in_range<T>(int()); // expected-error 10-11 {{no matching function for call to 'in_range'}}
72 std::in_range<int>(T()); // expected-error 10-11 {{no matching function for call to 'in_range'}}
74 #ifndef TEST_HAS_NO_CHAR8_T
75 template <class T>
76 constexpr void test_char8t() {
77 std::cmp_equal(T(), T()); // expected-error 1 {{no matching function for call to 'cmp_equal'}}
78 std::cmp_equal(T(), int()); // expected-error 1 {{no matching function for call to 'cmp_equal'}}
79 std::cmp_equal(int(), T()); // expected-error 1 {{no matching function for call to 'cmp_equal'}}
80 std::cmp_not_equal(T(), T()); // expected-error 1 {{no matching function for call to 'cmp_not_equal'}}
81 std::cmp_not_equal(T(), int()); // expected-error 1 {{no matching function for call to 'cmp_not_equal'}}
82 std::cmp_not_equal(int(), T()); // expected-error 1 {{no matching function for call to 'cmp_not_equal'}}
83 std::cmp_less(T(), T()); // expected-error 1 {{no matching function for call to 'cmp_less'}}
84 std::cmp_less(T(), int()); // expected-error 1 {{no matching function for call to 'cmp_less'}}
85 std::cmp_less(int(), T()); // expected-error 1 {{no matching function for call to 'cmp_less'}}
86 std::cmp_less_equal(T(), T()); // expected-error 1 {{no matching function for call to 'cmp_less_equal'}}
87 std::cmp_less_equal(T(), int()); // expected-error 1 {{no matching function for call to 'cmp_less_equal'}}
88 std::cmp_less_equal(int(), T()); // expected-error 1 {{no matching function for call to 'cmp_less_equal'}}
89 std::cmp_greater(T(), T()); // expected-error 1 {{no matching function for call to 'cmp_greater'}}
90 std::cmp_greater(T(), int()); // expected-error 1 {{no matching function for call to 'cmp_greater'}}
91 std::cmp_greater(int(), T()); // expected-error 1 {{no matching function for call to 'cmp_greater'}}
92 std::cmp_greater_equal(T(), T()); // expected-error 1 {{no matching function for call to 'cmp_greater_equal'}}
93 std::cmp_greater_equal(T(), int()); // expected-error 1 {{no matching function for call to 'cmp_greater_equal'}}
94 std::cmp_greater_equal(int(), T()); // expected-error 1 {{no matching function for call to 'cmp_greater_equal'}}
95 std::in_range<T>(int()); // expected-error 1 {{no matching function for call to 'in_range'}}
96 std::in_range<int>(T()); // expected-error 1 {{no matching function for call to 'in_range'}}
98 #endif // TEST_HAS_NO_CHAR8_T
100 template <class T>
101 constexpr void test_uchars() {
102 std::cmp_equal(T(), T()); // expected-error 2 {{no matching function for call to 'cmp_equal'}}
103 std::cmp_equal(T(), int()); // expected-error 2 {{no matching function for call to 'cmp_equal'}}
104 std::cmp_equal(int(), T()); // expected-error 2 {{no matching function for call to 'cmp_equal'}}
105 std::cmp_not_equal(T(), T()); // expected-error 2 {{no matching function for call to 'cmp_not_equal'}}
106 std::cmp_not_equal(T(), int()); // expected-error 2 {{no matching function for call to 'cmp_not_equal'}}
107 std::cmp_not_equal(int(), T()); // expected-error 2 {{no matching function for call to 'cmp_not_equal'}}
108 std::cmp_less(T(), T()); // expected-error 2 {{no matching function for call to 'cmp_less'}}
109 std::cmp_less(T(), int()); // expected-error 2 {{no matching function for call to 'cmp_less'}}
110 std::cmp_less(int(), T()); // expected-error 2 {{no matching function for call to 'cmp_less'}}
111 std::cmp_less_equal(T(), T()); // expected-error 2 {{no matching function for call to 'cmp_less_equal'}}
112 std::cmp_less_equal(T(), int()); // expected-error 2 {{no matching function for call to 'cmp_less_equal'}}
113 std::cmp_less_equal(int(), T()); // expected-error 2 {{no matching function for call to 'cmp_less_equal'}}
114 std::cmp_greater(T(), T()); // expected-error 2 {{no matching function for call to 'cmp_greater'}}
115 std::cmp_greater(T(), int()); // expected-error 2 {{no matching function for call to 'cmp_greater'}}
116 std::cmp_greater(int(), T()); // expected-error 2 {{no matching function for call to 'cmp_greater'}}
117 std::cmp_greater_equal(T(), T()); // expected-error 2 {{no matching function for call to 'cmp_greater_equal'}}
118 std::cmp_greater_equal(T(), int()); // expected-error 2 {{no matching function for call to 'cmp_greater_equal'}}
119 std::cmp_greater_equal(int(), T()); // expected-error 2 {{no matching function for call to 'cmp_greater_equal'}}
120 std::in_range<T>(int()); // expected-error 2 {{no matching function for call to 'in_range'}}
121 std::in_range<int>(T()); // expected-error 2 {{no matching function for call to 'in_range'}}
124 int main(int, char**) {
125 test<bool>();
126 test<char>();
127 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
128 test<wchar_t>();
129 #endif
130 test<float>();
131 test<double>();
132 test<long double>();
133 test<std::byte>();
134 test<NonEmptyT>();
135 test<ColorT>();
136 test<std::nullptr_t>();
137 test<EmptyT>();
139 #ifndef TEST_HAS_NO_CHAR8_T
140 test_char8t<char8_t>();
141 #endif // TEST_HAS_NO_CHAR8_T
143 test_uchars<char16_t>();
144 test_uchars<char32_t>();
146 return 0;