brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 4b00160 Raw
59 lines · cpp
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-exception6//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++2013// template <class T, size_t N>14//   bool operator!=(const array<T,N>& x, const array<T,N>& y);    // removed in C++2015// template <class T, size_t N>16//   bool operator<(const array<T,N>& x, const array<T,N>& y);     // removed in C++2017// template <class T, size_t N>18//   bool operator>(const array<T,N>& x, const array<T,N>& y);     // removed in C++2019// template <class T, size_t N>20//   bool operator<=(const array<T,N>& x, const array<T,N>& y);    // removed in C++2021// template <class T, size_t N>22//   bool operator>=(const array<T,N>& x, const array<T,N>& y);    // removed in C++2023 24#include <array>25 26#include "test_macros.h"27 28template <int>29struct NoCompare {};30 31int main(int, char**) {32  {33    typedef NoCompare<0> T;34    typedef std::array<T, 3> C;35    C c1 = {{}};36    // expected-error@*:* 2 {{invalid operands to binary expression}}37    TEST_IGNORE_NODISCARD(c1 == c1);38    TEST_IGNORE_NODISCARD(c1 < c1);39  }40  {41    typedef NoCompare<1> T;42    typedef std::array<T, 3> C;43    C c1 = {{}};44    // expected-error@*:* 2 {{invalid operands to binary expression}}45    TEST_IGNORE_NODISCARD(c1 != c1);46    TEST_IGNORE_NODISCARD(c1 > c1);47  }48  {49    typedef NoCompare<2> T;50    typedef std::array<T, 0> C;51    C c1 = {{}};52    // expected-error@*:* 2 {{invalid operands to binary expression}}53    TEST_IGNORE_NODISCARD(c1 == c1);54    TEST_IGNORE_NODISCARD(c1 < c1);55  }56 57  return 0;58}59