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 | // <set> |
11 | |
12 | // class set |
13 | |
14 | // template<class Key, class Compare, class Allocator> |
15 | // synth-three-way-result<Key> operator<=>(const set<Key, Compare, Allocator>& x, |
16 | // const set<Key, Compare, Allocator>& y); |
17 | |
18 | #include <set> |
19 | |
20 | #include "test_allocator.h" |
21 | |
22 | int main(int, char**) { |
23 | // Mismatching allocators |
24 | { |
25 | std::set<int, std::less<int>, std::allocator<int>> s1; |
26 | std::set<int, std::less<int>, test_allocator<int>> s2; |
27 | // expected-error@+1 {{invalid operands to binary expression}} |
28 | s1 <=> s2; |
29 | // expected-error@+1 {{invalid operands to binary expression}} |
30 | s2 <=> s1; |
31 | } |
32 | // Mismatching comparision functions |
33 | { |
34 | std::set<int, std::less<int>> s1; |
35 | std::set<int, std::greater<int>> s2; |
36 | // expected-error@+1 {{invalid operands to binary expression}} |
37 | s1 <=> s2; |
38 | // expected-error@+1 {{invalid operands to binary expression}} |
39 | s2 <=> s1; |
40 | } |
41 | { |
42 | std::set<int, std::less<int>> s1; |
43 | std::set<int, std::less<float>> s2; |
44 | // expected-error@+1 {{invalid operands to binary expression}} |
45 | s1 <=> s2; |
46 | // expected-error@+1 {{invalid operands to binary expression}} |
47 | s2 <=> s1; |
48 | } |
49 | // Mismatching types |
50 | { |
51 | std::set<int> s1; |
52 | std::set<float> s2; |
53 | // expected-error@+1 {{invalid operands to binary expression}} |
54 | s1 <=> s2; |
55 | // expected-error@+1 {{invalid operands to binary expression}} |
56 | s2 <=> s1; |
57 | } |
58 | |
59 | return 0; |
60 | } |
61 | |