| 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 |
// <map> |
| 11 |
|
| 12 |
// class multimap |
| 13 |
|
| 14 |
// template<class Key, class T, class Compare, class Allocator> |
| 15 |
// synth-three-way-result<pair<const Key, T>> |
| 16 |
// operator<=>(const multimap<Key, T, Compare, Allocator>& x, |
| 17 |
// const multimap<Key, T, Compare, Allocator>& y); |
| 18 |
|
| 19 |
#include <map> |
| 20 |
|
| 21 |
#include "test_allocator.h" |
| 22 |
|
| 23 |
int main(int, char**) { |
| 24 |
// Mismatching allocators |
| 25 |
{ |
| 26 |
std::multimap<int, int, std::less<int>, std::allocator<int>> s1; |
| 27 |
std::multimap<int, int, std::less<int>, test_allocator<int>> s2; |
| 28 |
// expected-error-re@*:* {{static assertion failed due to requirement {{.+}}Allocator::value_type must be same type as value_type}} |
| 29 |
s1 <=> s2; |
| 30 |
// expected-error-re@*:* {{static assertion failed due to requirement {{.+}}Allocator::value_type must be same type as value_type}} |
| 31 |
s2 <=> s1; |
| 32 |
} |
| 33 |
// Mismatching comparision functions |
| 34 |
{ |
| 35 |
std::multimap<int, int, std::less<int>> s1; |
| 36 |
std::multimap<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; |
| 41 |
} |
| 42 |
{ |
| 43 |
std::multimap<int, int, std::less<int>> s1; |
| 44 |
std::multimap<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; |
| 49 |
} |
| 50 |
// Mismatching types |
| 51 |
{ |
| 52 |
std::multimap<int, int> s1; |
| 53 |
std::multimap<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; |
| 58 |
} |
| 59 |
|
| 60 |
return 0; |
| 61 |
} |