| 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 |
// <array> |
| 10 |
|
| 11 |
// template <class T, size_t N> |
| 12 |
// bool operator==(const array<T,N>& x, const array<T,N>& y); // constexpr in C++20 |
| 13 |
// template <class T, size_t N> |
| 14 |
// bool operator!=(const array<T,N>& x, const array<T,N>& y); // removed in C++20 |
| 15 |
// template <class T, size_t N> |
| 16 |
// bool operator<(const array<T,N>& x, const array<T,N>& y); // removed in C++20 |
| 17 |
// template <class T, size_t N> |
| 18 |
// bool operator>(const array<T,N>& x, const array<T,N>& y); // removed in C++20 |
| 19 |
// template <class T, size_t N> |
| 20 |
// bool operator<=(const array<T,N>& x, const array<T,N>& y); // removed in C++20 |
| 21 |
// template <class T, size_t N> |
| 22 |
// bool operator>=(const array<T,N>& x, const array<T,N>& y); // removed in C++20 |
| 23 |
|
| 24 |
#include <array> |
| 25 |
|
| 26 |
#include "test_macros.h" |
| 27 |
|
| 28 |
template <int> |
| 29 |
struct NoCompare {}; |
| 30 |
|
| 31 |
#if TEST_STD_VER >= 14 && TEST_STD_VER <= 17 |
| 32 |
// expected-error@*:* 3 {{no matching function for call to object of type 'std::__less<void, void>'}} |
| 33 |
#endif |
| 34 |
|
| 35 |
int main(int, char**) { |
| 36 |
{ |
| 37 |
typedef NoCompare<0> T; |
| 38 |
typedef std::array<T, 3> C; |
| 39 |
C c1 = {{}}; |
| 40 |
// expected-error@*:* 2 {{invalid operands to binary expression}} |
| 41 |
TEST_IGNORE_NODISCARD(c1 == c1); |
| 42 |
TEST_IGNORE_NODISCARD(c1 < c1); |
| 43 |
} |
| 44 |
{ |
| 45 |
typedef NoCompare<1> T; |
| 46 |
typedef std::array<T, 3> C; |
| 47 |
C c1 = {{}}; |
| 48 |
// expected-error@*:* 2 {{invalid operands to binary expression}} |
| 49 |
TEST_IGNORE_NODISCARD(c1 != c1); |
| 50 |
TEST_IGNORE_NODISCARD(c1 > c1); |
| 51 |
} |
| 52 |
{ |
| 53 |
typedef NoCompare<2> T; |
| 54 |
typedef std::array<T, 0> C; |
| 55 |
C c1 = {{}}; |
| 56 |
// expected-error@*:* 2 {{invalid operands to binary expression}} |
| 57 |
TEST_IGNORE_NODISCARD(c1 == c1); |
| 58 |
TEST_IGNORE_NODISCARD(c1 < c1); |
| 59 |
} |
| 60 |
|
| 61 |
return 0; |
| 62 |
} |