1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
8 // UNSUPPORTED: c++03, c++11, c++14, c++17
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);
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}}
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}}
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}}
39 // expected-error@+1 {{invalid operands to binary expression}}
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}}
47 // expected-error@+1 {{invalid operands to binary expression}}
52 std::map
<int, int> s1
;
53 std::map
<int, float> s2
;
54 // expected-error@+1 {{invalid operands to binary expression}}
56 // expected-error@+1 {{invalid operands to binary expression}}