xref: /llvm-project/libcxx/test/std/containers/sequences/array/compare.three_way.verify.cpp (revision 254986d2df8d8407b46329e452c16748d29ed4cd)
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 // UNSUPPORTED: c++03, c++11, c++14, c++17
9 
10 // <array>
11 
12 // template<class T, size_t N>
13 //   constexpr synth-three-way-result<T>
14 //     operator<=>(const array<T, N>& x, const array<T, N>& y);
15 
16 // arrays with different sizes should not compare
17 
18 #include <array>
19 
main(int,char **)20 int main(int, char**) {
21   {
22     std::array a1{1};
23     std::array a2{1, 2};
24 
25     // expected-error@*:* {{invalid operands to binary expression}}
26     a1 <=> a2;
27   }
28   {
29     std::array a1{1, 2};
30     std::array a2{1};
31 
32     // expected-error@*:* {{invalid operands to binary expression}}
33     a1 <=> a2;
34   }
35 
36   return 0;
37 }
38