[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / libcxx / test / std / containers / sequences / array / compare.fail.cpp
blob47859ad49db525070819fd1c3b4d5e3edac8c385
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 // <array>
11 // bool operator==(array<T, N> const&, array<T, N> const&);
12 // bool operator!=(array<T, N> const&, array<T, N> const&);
13 // bool operator<(array<T, N> const&, array<T, N> const&);
14 // bool operator<=(array<T, N> const&, array<T, N> const&);
15 // bool operator>(array<T, N> const&, array<T, N> const&);
16 // bool operator>=(array<T, N> const&, array<T, N> const&);
19 #include <array>
20 #include <vector>
21 #include <cassert>
23 #include "test_macros.h"
25 // std::array is explicitly allowed to be initialized with A a = { init-list };.
26 // Disable the missing braces warning for this reason.
27 #include "disable_missing_braces_warning.h"
29 template <class Array>
30 void test_compare(const Array& LHS, const Array& RHS) {
31 typedef std::vector<typename Array::value_type> Vector;
32 const Vector LHSV(LHS.begin(), LHS.end());
33 const Vector RHSV(RHS.begin(), RHS.end());
34 assert((LHS == RHS) == (LHSV == RHSV));
35 assert((LHS != RHS) == (LHSV != RHSV));
36 assert((LHS < RHS) == (LHSV < RHSV));
37 assert((LHS <= RHS) == (LHSV <= RHSV));
38 assert((LHS > RHS) == (LHSV > RHSV));
39 assert((LHS >= RHS) == (LHSV >= RHSV));
42 template <int Dummy> struct NoCompare {};
44 int main(int, char**)
47 typedef NoCompare<0> T;
48 typedef std::array<T, 3> C;
49 C c1 = {{}};
50 // expected-error@algorithm:* 2 {{invalid operands to binary expression}}
51 TEST_IGNORE_NODISCARD (c1 == c1);
52 TEST_IGNORE_NODISCARD (c1 < c1);
55 typedef NoCompare<1> T;
56 typedef std::array<T, 3> C;
57 C c1 = {{}};
58 // expected-error@algorithm:* 2 {{invalid operands to binary expression}}
59 TEST_IGNORE_NODISCARD (c1 != c1);
60 TEST_IGNORE_NODISCARD (c1 > c1);
63 typedef NoCompare<2> T;
64 typedef std::array<T, 0> C;
65 C c1 = {{}};
66 // expected-error@algorithm:* 2 {{invalid operands to binary expression}}
67 TEST_IGNORE_NODISCARD (c1 == c1);
68 TEST_IGNORE_NODISCARD (c1 < c1);
71 return 0;