Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / containers / associative / map / map.nonmember / compare.three_way.verify.cpp
blob2427525664558b5bea461372d87f175dc04594d7
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
10 // <map>
12 // class map
14 // template<class Key, class T, class Compare, class Allocator>
15 // synth-three-way-result<pair<const Key, T>>
16 // operator<=>(const map<Key, T, Compare, Allocator>& x,
17 // const map<Key, T, Compare, Allocator>& y);
19 #include <map>
21 #include "test_allocator.h"
23 int main(int, char**) {
24 // Mismatching allocators
26 std::map<int, int, std::less<int>, std::allocator<int>> s1;
27 std::map<int, int, std::less<int>, test_allocator<int>> s2;
28 // expected-error-re@*:* {{static assertion failed due to requirement 'is_same<int, std::pair<const int, int>>::value'{{.*}}Allocator::value_type must be same type as value_type}}
29 s1 <=> s2;
30 // expected-error-re@*:* {{static assertion failed due to requirement 'is_same<int, std::pair<const int, int>>::value'{{.*}}Allocator::value_type must be same type as value_type}}
31 s2 <=> s1;
33 // Mismatching comparision functions
35 std::map<int, int, std::less<int>> s1;
36 std::map<int, int, std::greater<int>> s2;
37 // expected-error@+1 {{invalid operands to binary expression}}
38 s1 <=> s2;
39 // expected-error@+1 {{invalid operands to binary expression}}
40 s2 <=> s1;
43 std::map<int, int, std::less<int>> s1;
44 std::map<int, int, std::less<float>> s2;
45 // expected-error@+1 {{invalid operands to binary expression}}
46 s1 <=> s2;
47 // expected-error@+1 {{invalid operands to binary expression}}
48 s2 <=> s1;
50 // Mismatching types
52 std::map<int, int> s1;
53 std::map<int, float> s2;
54 // expected-error@+1 {{invalid operands to binary expression}}
55 s1 <=> s2;
56 // expected-error@+1 {{invalid operands to binary expression}}
57 s2 <=> s1;
60 return 0;